1 // Copyright 2013 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. 4 5 #include "apps/shell/common/shell_content_client.h" 6 7 #include "base/strings/string_piece.h" 8 #include "base/strings/utf_string_conversions.h" 9 #include "content/public/common/user_agent.h" 10 #include "extensions/common/constants.h" 11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/resource/resource_bundle.h" 13 14 namespace apps { 15 ShellContentClient()16ShellContentClient::ShellContentClient() {} 17 ~ShellContentClient()18ShellContentClient::~ShellContentClient() {} 19 AddAdditionalSchemes(std::vector<std::string> * standard_schemes,std::vector<std::string> * savable_schemes)20void ShellContentClient::AddAdditionalSchemes( 21 std::vector<std::string>* standard_schemes, 22 std::vector<std::string>* savable_schemes) { 23 standard_schemes->push_back(extensions::kExtensionScheme); 24 savable_schemes->push_back(extensions::kExtensionScheme); 25 standard_schemes->push_back(extensions::kExtensionResourceScheme); 26 savable_schemes->push_back(extensions::kExtensionResourceScheme); 27 } 28 GetUserAgent() const29std::string ShellContentClient::GetUserAgent() const { 30 // TODO(derat): Figure out what this should be for app_shell and determine 31 // whether we need to include a version number to placate browser sniffing. 32 return content::BuildUserAgentFromProduct("Chrome"); 33 } 34 GetLocalizedString(int message_id) const35base::string16 ShellContentClient::GetLocalizedString(int message_id) const { 36 return l10n_util::GetStringUTF16(message_id); 37 } 38 GetDataResource(int resource_id,ui::ScaleFactor scale_factor) const39base::StringPiece ShellContentClient::GetDataResource( 40 int resource_id, 41 ui::ScaleFactor scale_factor) const { 42 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( 43 resource_id, scale_factor); 44 } 45 GetDataResourceBytes(int resource_id) const46base::RefCountedStaticMemory* ShellContentClient::GetDataResourceBytes( 47 int resource_id) const { 48 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); 49 } 50 GetNativeImageNamed(int resource_id) const51gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { 52 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); 53 } 54 55 } // namespace apps 56