| 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 "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 11 #include "content/public/common/user_agent.h" |
| 11 #include "content/shell/common/shell_switches.h" | 12 #include "content/shell/common/shell_switches.h" |
| 12 #include "grit/shell_resources.h" | 13 #include "grit/shell_resources.h" |
| 13 #include "grit/webkit_resources.h" | 14 #include "grit/webkit_resources.h" |
| 14 #include "grit/webkit_strings.h" | 15 #include "grit/webkit_strings.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "webkit/common/user_agent/user_agent_util.h" | |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 ShellContentClient::~ShellContentClient() { | 21 ShellContentClient::~ShellContentClient() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 std::string ShellContentClient::GetUserAgent() const { | 24 std::string ShellContentClient::GetUserAgent() const { |
| 25 std::string product = "Chrome/" CONTENT_SHELL_VERSION; | 25 std::string product = "Chrome/" CONTENT_SHELL_VERSION; |
| 26 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 26 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 27 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) | 27 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
| 28 product += " Mobile"; | 28 product += " Mobile"; |
| 29 return webkit_glue::BuildUserAgentFromProduct(product); | 29 return BuildUserAgentFromProduct(product); |
| 30 } | 30 } |
| 31 | 31 |
| 32 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { | 32 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { |
| 33 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 33 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 34 switch (message_id) { | 34 switch (message_id) { |
| 35 case IDS_FORM_OTHER_DATE_LABEL: | 35 case IDS_FORM_OTHER_DATE_LABEL: |
| 36 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 36 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
| 37 case IDS_FORM_OTHER_MONTH_LABEL: | 37 case IDS_FORM_OTHER_MONTH_LABEL: |
| 38 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); | 38 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); |
| 39 case IDS_FORM_OTHER_TIME_LABEL: | 39 case IDS_FORM_OTHER_TIME_LABEL: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 base::RefCountedStaticMemory* ShellContentClient::GetDataResourceBytes( | 78 base::RefCountedStaticMemory* ShellContentClient::GetDataResourceBytes( |
| 79 int resource_id) const { | 79 int resource_id) const { |
| 80 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); | 80 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); |
| 81 } | 81 } |
| 82 | 82 |
| 83 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { | 83 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { |
| 84 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); | 84 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace content | 87 } // namespace content |
| OLD | NEW |