2013-03-14 13:03:50 +00:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
|
|
|
#include "common/content_client.h"
|
|
|
|
|
2013-04-08 16:41:30 +00:00
|
|
|
#include "common/application_info.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
|
2013-10-07 19:16:49 +00:00
|
|
|
#include "base/strings/stringprintf.h"
|
|
|
|
#include "base/strings/string_util.h"
|
2014-06-26 20:34:53 +00:00
|
|
|
#include "content/public/common/user_agent.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
ContentClient::ContentClient() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ContentClient::~ContentClient() {
|
|
|
|
}
|
|
|
|
|
2013-04-08 16:41:30 +00:00
|
|
|
std::string ContentClient::GetProduct() const {
|
2013-04-08 16:42:37 +00:00
|
|
|
auto name = GetApplicationName();
|
2014-06-26 20:29:38 +00:00
|
|
|
base::RemoveChars(name, base::kWhitespaceASCII, &name);
|
2013-11-17 23:56:44 +00:00
|
|
|
return base::StringPrintf("%s/%s",
|
|
|
|
name.c_str(), GetApplicationVersion().c_str());
|
2013-04-08 16:41:30 +00:00
|
|
|
}
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
std::string ContentClient::GetUserAgent() const {
|
2014-06-26 20:34:53 +00:00
|
|
|
return content::BuildUserAgentFromProduct(GetProduct());
|
2013-03-14 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 23:56:44 +00:00
|
|
|
base::StringPiece ContentClient::GetDataResource(
|
|
|
|
int resource_id, ui::ScaleFactor scale_factor) const {
|
|
|
|
return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
|
|
|
|
resource_id, scale_factor);
|
2013-03-14 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2013-04-27 02:49:24 +00:00
|
|
|
gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const {
|
2013-11-17 23:56:44 +00:00
|
|
|
return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
|
|
|
|
resource_id);
|
2013-04-27 02:49:24 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|