OLD | NEW |
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 |
23 std::string GetShellUserAgent() { | 36 std::string GetShellUserAgent() { |
24 std::string product = "Chrome/" CONTENT_SHELL_VERSION; | 37 std::string product = "Chrome/" CONTENT_SHELL_VERSION; |
25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
26 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) | 39 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
27 product += " Mobile"; | 40 product += " Mobile"; |
28 return BuildUserAgentFromProduct(product); | 41 return BuildUserAgentFromProduct(product); |
29 } | 42 } |
30 | 43 |
31 ShellContentClient::~ShellContentClient() { | 44 ShellContentClient::ShellContentClient() |
32 } | 45 : origin_trial_public_key_(base::StringPiece( |
| 46 reinterpret_cast<const char*>(kOriginTrialPublicKey), |
| 47 arraysize(kOriginTrialPublicKey))) {} |
| 48 |
| 49 ShellContentClient::~ShellContentClient() {} |
33 | 50 |
34 std::string ShellContentClient::GetUserAgent() const { | 51 std::string ShellContentClient::GetUserAgent() const { |
35 return GetShellUserAgent(); | 52 return GetShellUserAgent(); |
36 } | 53 } |
37 | 54 |
38 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { | 55 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { |
39 if (switches::IsRunLayoutTestSwitchPresent()) { | 56 if (switches::IsRunLayoutTestSwitchPresent()) { |
40 switch (message_id) { | 57 switch (message_id) { |
41 case IDS_FORM_OTHER_DATE_LABEL: | 58 case IDS_FORM_OTHER_DATE_LABEL: |
42 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 59 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 105 |
89 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { | 106 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { |
90 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); | 107 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); |
91 } | 108 } |
92 | 109 |
93 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { | 110 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { |
94 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 111 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
95 switches::kIsolateSitesForTesting); | 112 switches::kIsolateSitesForTesting); |
96 } | 113 } |
97 | 114 |
| 115 base::StringPiece ShellContentClient::GetOriginTrialPublicKey() { |
| 116 return origin_trial_public_key_; |
| 117 } |
| 118 |
98 } // namespace content | 119 } // namespace content |
OLD | NEW |