Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: extensions/shell/common/shell_content_client.cc

Issue 505403003: app_shell: Add version number in user agent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/shell/common/shell_content_client.h" 5 #include "extensions/shell/common/shell_content_client.h"
6 6
7 #include "base/strings/string_piece.h" 7 #include "base/strings/string_piece.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/common/user_agent.h" 9 #include "content/public/common/user_agent.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
11 #include "extensions/shell/common/version.h" // Generated file.
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 14
14 #if !defined(DISABLE_NACL) 15 #if !defined(DISABLE_NACL)
15 #include "base/base_paths.h" 16 #include "base/base_paths.h"
16 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "components/nacl/common/nacl_constants.h" 19 #include "components/nacl/common/nacl_constants.h"
19 #include "content/public/common/pepper_plugin_info.h" 20 #include "content/public/common/pepper_plugin_info.h"
20 #include "ppapi/native_client/src/trusted/plugin/ppapi_entrypoints.h" 21 #include "ppapi/native_client/src/trusted/plugin/ppapi_entrypoints.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void ShellContentClient::AddAdditionalSchemes( 77 void ShellContentClient::AddAdditionalSchemes(
77 std::vector<std::string>* standard_schemes, 78 std::vector<std::string>* standard_schemes,
78 std::vector<std::string>* savable_schemes) { 79 std::vector<std::string>* savable_schemes) {
79 standard_schemes->push_back(kExtensionScheme); 80 standard_schemes->push_back(kExtensionScheme);
80 savable_schemes->push_back(kExtensionScheme); 81 savable_schemes->push_back(kExtensionScheme);
81 standard_schemes->push_back(kExtensionResourceScheme); 82 standard_schemes->push_back(kExtensionResourceScheme);
82 savable_schemes->push_back(kExtensionResourceScheme); 83 savable_schemes->push_back(kExtensionResourceScheme);
83 } 84 }
84 85
85 std::string ShellContentClient::GetUserAgent() const { 86 std::string ShellContentClient::GetUserAgent() const {
86 // TODO(derat): Figure out what this should be for app_shell and determine 87 // Must contain a user agent string for version sniffing. For example,
87 // whether we need to include a version number to placate browser sniffing. 88 // pluginless WebRTC Hangouts checks the Chrome version number.
88 return content::BuildUserAgentFromProduct("Chrome"); 89 return content::BuildUserAgentFromProduct("Chrome/" PRODUCT_VERSION);
89 } 90 }
90 91
91 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { 92 base::string16 ShellContentClient::GetLocalizedString(int message_id) const {
92 return l10n_util::GetStringUTF16(message_id); 93 return l10n_util::GetStringUTF16(message_id);
93 } 94 }
94 95
95 base::StringPiece ShellContentClient::GetDataResource( 96 base::StringPiece ShellContentClient::GetDataResource(
96 int resource_id, 97 int resource_id,
97 ui::ScaleFactor scale_factor) const { 98 ui::ScaleFactor scale_factor) const {
98 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( 99 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
99 resource_id, scale_factor); 100 resource_id, scale_factor);
100 } 101 }
101 102
102 base::RefCountedStaticMemory* ShellContentClient::GetDataResourceBytes( 103 base::RefCountedStaticMemory* ShellContentClient::GetDataResourceBytes(
103 int resource_id) const { 104 int resource_id) const {
104 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); 105 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
105 } 106 }
106 107
107 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { 108 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const {
108 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); 109 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
109 } 110 }
110 111
111 } // namespace extensions 112 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/app_shell.gyp ('k') | extensions/shell/common/shell_content_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698