1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_content_client.h"
7 #include "base/logging.h"
8 #include "base/strings/string_piece.h"
9 #include "chrome/common/chrome_version_info.h"
10 #include "chrome/common/url_constants.h"
11 #include "content/public/common/user_agent.h"
12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h"
16 // TODO(ios): Investigate merging with chrome_content_client.cc; this would
17 // requiring either a lot of ifdefing, or spliting the file into parts.
19 void ChromeContentClient::SetActiveURL(const GURL& url) {
23 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
27 void ChromeContentClient::AddPepperPlugins(
28 std::vector<content::PepperPluginInfo>* plugins) {
32 void ChromeContentClient::AddAdditionalSchemes(
33 std::vector<std::string>* standard_schemes,
34 std::vector<std::string>* saveable_shemes) {
35 // No additional schemes for iOS.
38 bool ChromeContentClient::CanHandleWhileSwappedOut(
39 const IPC::Message& msg) {
44 std::string ChromeContentClient::GetProduct() const {
45 chrome::VersionInfo version_info;
46 std::string product("CriOS/");
47 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
51 std::string ChromeContentClient::GetUserAgent() const {
52 std::string product = GetProduct();
53 return content::BuildUserAgentFromProduct(product);
56 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
57 return l10n_util::GetStringUTF16(message_id);
60 base::StringPiece ChromeContentClient::GetDataResource(
62 ui::ScaleFactor scale_factor) const {
63 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
64 resource_id, scale_factor);
67 base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
68 int resource_id) const {
69 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
72 gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
73 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
76 std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
77 DCHECK(false) << "Unknown child process type!";