[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / content / shell / shell_content_client.cc
blob648e61555265e7240ef2993e12aee43cd71dfc80
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
3 // found in the LICENSE file.
5 #include "content/shell/shell_content_client.h"
7 #include "base/command_line.h"
8 #include "base/string_piece.h"
9 #include "content/public/common/content_switches.h"
10 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/base/resource/resource_bundle.h"
12 #include "webkit/user_agent/user_agent_util.h"
14 namespace content {
16 ShellContentClient::~ShellContentClient() {
19 std::string ShellContentClient::GetUserAgent() const {
20 std::string product = "Chrome/" CONTENT_SHELL_VERSION;
21 CommandLine* command_line = CommandLine::ForCurrentProcess();
22 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
23 product += " Mobile";
24 return webkit_glue::BuildUserAgentFromProduct(product);
27 string16 ShellContentClient::GetLocalizedString(int message_id) const {
28 return l10n_util::GetStringUTF16(message_id);
31 base::StringPiece ShellContentClient::GetDataResource(
32 int resource_id,
33 ui::ScaleFactor scale_factor) const {
34 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
35 resource_id, scale_factor);
38 } // namespace content