| 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_messages.h" |
| 16 #include "content/shell/common/shell_switches.h" | 17 #include "content/shell/common/shell_switches.h" |
| 17 #include "grit/shell_resources.h" | 18 #include "grit/shell_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // This is the public key which the content shell will use to enable origin | 26 // This is the public key which the content shell will use to enable origin |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 return BuildUserAgentFromProduct(product); | 42 return BuildUserAgentFromProduct(product); |
| 42 } | 43 } |
| 43 | 44 |
| 44 ShellContentClient::ShellContentClient() | 45 ShellContentClient::ShellContentClient() |
| 45 : origin_trial_public_key_(base::StringPiece( | 46 : origin_trial_public_key_(base::StringPiece( |
| 46 reinterpret_cast<const char*>(kOriginTrialPublicKey), | 47 reinterpret_cast<const char*>(kOriginTrialPublicKey), |
| 47 arraysize(kOriginTrialPublicKey))) {} | 48 arraysize(kOriginTrialPublicKey))) {} |
| 48 | 49 |
| 49 ShellContentClient::~ShellContentClient() {} | 50 ShellContentClient::~ShellContentClient() {} |
| 50 | 51 |
| 52 bool ShellContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { |
| 53 // Used in layout tests; handled in BlinkTestController. |
| 54 return message->type() == ShellViewHostMsg_PrintMessage::ID || |
| 55 message->type() == ShellViewHostMsg_LayoutDumpFlagsChanged::ID; |
| 56 } |
| 57 |
| 51 std::string ShellContentClient::GetUserAgent() const { | 58 std::string ShellContentClient::GetUserAgent() const { |
| 52 return GetShellUserAgent(); | 59 return GetShellUserAgent(); |
| 53 } | 60 } |
| 54 | 61 |
| 55 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { | 62 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { |
| 56 if (switches::IsRunLayoutTestSwitchPresent()) { | 63 if (switches::IsRunLayoutTestSwitchPresent()) { |
| 57 switch (message_id) { | 64 switch (message_id) { |
| 58 case IDS_FORM_OTHER_DATE_LABEL: | 65 case IDS_FORM_OTHER_DATE_LABEL: |
| 59 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 66 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
| 60 case IDS_FORM_OTHER_MONTH_LABEL: | 67 case IDS_FORM_OTHER_MONTH_LABEL: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { | 117 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { |
| 111 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 118 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 switches::kIsolateSitesForTesting); | 119 switches::kIsolateSitesForTesting); |
| 113 } | 120 } |
| 114 | 121 |
| 115 base::StringPiece ShellContentClient::GetOriginTrialPublicKey() { | 122 base::StringPiece ShellContentClient::GetOriginTrialPublicKey() { |
| 116 return origin_trial_public_key_; | 123 return origin_trial_public_key_; |
| 117 } | 124 } |
| 118 | 125 |
| 119 } // namespace content | 126 } // namespace content |
| OLD | NEW |