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/public/common/content_client.h"
7 #include "base/logging.h"
8 #include "base/string_piece.h"
9 #include "ui/gfx/image/image.h"
10 #include "webkit/plugins/ppapi/host_globals.h"
11 #include "webkit/user_agent/user_agent.h"
15 static ContentClient
* g_client
;
17 void SetContentClient(ContentClient
* client
) {
20 // Set the default user agent as provided by the client. We need to make
21 // sure this is done before webkit_glue::GetUserAgent() is called (so that
22 // the UA doesn't change).
24 webkit_glue::SetUserAgent(client
->GetUserAgent(), false);
28 ContentClient
* GetContentClient() {
32 const std::string
& GetUserAgent(const GURL
& url
) {
34 return webkit_glue::GetUserAgent(url
);
37 webkit::ppapi::HostGlobals
* GetHostGlobals() {
38 return webkit::ppapi::HostGlobals::Get();
41 ContentClient::ContentClient()
42 : browser_(NULL
), plugin_(NULL
), renderer_(NULL
), utility_(NULL
) {
45 ContentClient::~ContentClient() {
48 bool ContentClient::HasWebUIScheme(const GURL
& url
) const {
52 bool ContentClient::CanHandleWhileSwappedOut(const IPC::Message
& message
) {
56 std::string
ContentClient::GetProduct() const {
60 std::string
ContentClient::GetUserAgent() const {
64 string16
ContentClient::GetLocalizedString(int message_id
) const {
68 base::StringPiece
ContentClient::GetDataResource(
70 ui::ScaleFactor scale_factor
) const {
71 return base::StringPiece();
74 gfx::Image
& ContentClient::GetNativeImageNamed(int resource_id
) const {
75 CR_DEFINE_STATIC_LOCAL(gfx::Image
, kEmptyImage
, ());
80 bool ContentClient::SandboxPlugin(CommandLine
* command_line
,
81 sandbox::TargetPolicy
* policy
) {
86 #if defined(OS_MACOSX) && !defined(OS_IOS)
87 bool ContentClient::GetSandboxProfileForSandboxType(
89 int* sandbox_profile_resource_id
) const {
93 std::string
ContentClient::GetCarbonInterposePath() const {
98 } // namespace content