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

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

Issue 2049783002: Refactor OriginTrialPolicy to be an abstract interface in content/public/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ef-add-revoked-feature-list
Patch Set: Switch to lazy initialization in ChromeContentClient Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/common/shell_content_client.h" 5 #include "content/shell/common/shell_content_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "blink/public/resources/grit/blink_image_resources.h" 10 #include "blink/public/resources/grit/blink_image_resources.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "content/app/resources/grit/content_resources.h" 12 #include "content/app/resources/grit/content_resources.h"
13 #include "content/app/strings/grit/content_strings.h" 13 #include "content/app/strings/grit/content_strings.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/common/user_agent.h" 15 #include "content/public/common/user_agent.h"
16 #include "content/shell/common/shell_switches.h" 16 #include "content/shell/common/shell_switches.h"
17 #include "grit/shell_resources.h" 17 #include "grit/shell_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 namespace {
24
25 // This is the public key which the content shell will use to enable origin
26 // trial features.
27 // TODO(iclelland): Update this comment with the location of the public and
28 // private key files when the command-line tool CL lands
29 static const uint8_t kOriginTrialPublicKey[] = {
30 0x75, 0x10, 0xac, 0xf9, 0x3a, 0x1c, 0xb8, 0xa9, 0x28, 0x70, 0xd2,
31 0x9a, 0xd0, 0x0b, 0x59, 0xe1, 0xac, 0x2b, 0xb7, 0xd5, 0xca, 0x1f,
32 0x64, 0x90, 0x08, 0x8e, 0xa8, 0xe0, 0x56, 0x3a, 0x04, 0xd0,
33 };
34 } // namespace
35
36 std::string GetShellUserAgent() { 23 std::string GetShellUserAgent() {
37 std::string product = "Chrome/" CONTENT_SHELL_VERSION; 24 std::string product = "Chrome/" CONTENT_SHELL_VERSION;
38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
39 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) 26 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
40 product += " Mobile"; 27 product += " Mobile";
41 return BuildUserAgentFromProduct(product); 28 return BuildUserAgentFromProduct(product);
42 } 29 }
43 30
44 ShellContentClient::ShellContentClient() 31 ShellContentClient::ShellContentClient() {}
45 : origin_trial_public_key_(base::StringPiece(
46 reinterpret_cast<const char*>(kOriginTrialPublicKey),
47 arraysize(kOriginTrialPublicKey))) {}
48 32
49 ShellContentClient::~ShellContentClient() {} 33 ShellContentClient::~ShellContentClient() {}
50 34
51 std::string ShellContentClient::GetUserAgent() const { 35 std::string ShellContentClient::GetUserAgent() const {
52 return GetShellUserAgent(); 36 return GetShellUserAgent();
53 } 37 }
54 38
55 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { 39 base::string16 ShellContentClient::GetLocalizedString(int message_id) const {
56 if (switches::IsRunLayoutTestSwitchPresent()) { 40 if (switches::IsRunLayoutTestSwitchPresent()) {
57 switch (message_id) { 41 switch (message_id) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 89
106 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { 90 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const {
107 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); 91 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
108 } 92 }
109 93
110 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { 94 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() {
111 return base::CommandLine::ForCurrentProcess()->HasSwitch( 95 return base::CommandLine::ForCurrentProcess()->HasSwitch(
112 switches::kIsolateSitesForTesting); 96 switches::kIsolateSitesForTesting);
113 } 97 }
114 98
115 base::StringPiece ShellContentClient::GetOriginTrialPublicKey() { 99 OriginTrialPolicy* ShellContentClient::GetOriginTrialPolicy() {
116 return origin_trial_public_key_; 100 return &origin_trial_policy_;
117 } 101 }
118 102
119 } // namespace content 103 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/common/shell_content_client.h ('k') | content/shell/common/shell_origin_trial_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698