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/shell_content_client.h" | 5 #include "content/shell/shell_content_client.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "content/public/common/content_switches.h" |
8 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
9 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
10 #include "webkit/user_agent/user_agent_util.h" | 12 #include "webkit/user_agent/user_agent_util.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 ShellContentClient::~ShellContentClient() { | 16 ShellContentClient::~ShellContentClient() { |
15 } | 17 } |
16 | 18 |
17 std::string ShellContentClient::GetUserAgent() const { | 19 std::string ShellContentClient::GetUserAgent() const { |
18 // The "19" is so that sites that sniff for version think that this is | 20 // The "19" is so that sites that sniff for version think that this is |
19 // something reasonably current; the "77.34.5" is a hint that this isn't a | 21 // something reasonably current; the "77.34.5" is a hint that this isn't a |
20 // standard Chrome. | 22 // standard Chrome. |
21 return webkit_glue::BuildUserAgentFromProduct("Chrome/19.77.34.5"); | 23 std::string product = "Chrome/19.77.34.5"; |
| 24 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 25 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
| 26 product += " Mobile"; |
| 27 return webkit_glue::BuildUserAgentFromProduct(product); |
22 } | 28 } |
23 | 29 |
24 string16 ShellContentClient::GetLocalizedString(int message_id) const { | 30 string16 ShellContentClient::GetLocalizedString(int message_id) const { |
25 return l10n_util::GetStringUTF16(message_id); | 31 return l10n_util::GetStringUTF16(message_id); |
26 } | 32 } |
27 | 33 |
28 base::StringPiece ShellContentClient::GetDataResource( | 34 base::StringPiece ShellContentClient::GetDataResource( |
29 int resource_id, | 35 int resource_id, |
30 ui::ScaleFactor scale_factor) const { | 36 ui::ScaleFactor scale_factor) const { |
31 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 37 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
32 resource_id, scale_factor); | 38 resource_id, scale_factor); |
33 } | 39 } |
34 | 40 |
35 } // namespace content | 41 } // namespace content |
OLD | NEW |