Add ICU message format support
[chromium-blink-merge.git] / content / public / common / content_client.cc
blob421a0a335407b9da54c9cd86518c3dcfda34714d
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/strings/string_piece.h"
9 #include "content/public/common/origin_util.h"
10 #include "content/public/common/user_agent.h"
11 #include "ui/gfx/image/image.h"
13 namespace content {
15 static ContentClient* g_client;
17 class InternalTestInitializer {
18 public:
19 static ContentBrowserClient* SetBrowser(ContentBrowserClient* b) {
20 ContentBrowserClient* rv = g_client->browser_;
21 g_client->browser_ = b;
22 return rv;
25 static ContentRendererClient* SetRenderer(ContentRendererClient* r) {
26 ContentRendererClient* rv = g_client->renderer_;
27 g_client->renderer_ = r;
28 return rv;
31 static ContentUtilityClient* SetUtility(ContentUtilityClient* u) {
32 ContentUtilityClient* rv = g_client->utility_;
33 g_client->utility_ = u;
34 return rv;
38 void SetContentClient(ContentClient* client) {
39 g_client = client;
41 // TODO(jam): find out which static on Windows is causing this to have to be
42 // called on startup.
43 if (client)
44 client->GetUserAgent();
47 ContentClient* GetContentClient() {
48 return g_client;
51 ContentBrowserClient* SetBrowserClientForTesting(ContentBrowserClient* b) {
52 return InternalTestInitializer::SetBrowser(b);
55 ContentRendererClient* SetRendererClientForTesting(ContentRendererClient* r) {
56 return InternalTestInitializer::SetRenderer(r);
59 ContentUtilityClient* SetUtilityClientForTesting(ContentUtilityClient* u) {
60 return InternalTestInitializer::SetUtility(u);
63 ContentClient::ContentClient()
64 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) {
67 ContentClient::~ContentClient() {
70 bool ContentClient::CanSendWhileSwappedOut(const IPC::Message* message) {
71 return false;
74 std::string ContentClient::GetProduct() const {
75 return std::string();
78 std::string ContentClient::GetUserAgent() const {
79 return std::string();
82 base::string16 ContentClient::GetLocalizedString(int message_id) const {
83 return base::string16();
86 base::StringPiece ContentClient::GetDataResource(
87 int resource_id,
88 ui::ScaleFactor scale_factor) const {
89 return base::StringPiece();
92 base::RefCountedStaticMemory* ContentClient::GetDataResourceBytes(
93 int resource_id) const {
94 return NULL;
97 gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const {
98 CR_DEFINE_STATIC_LOCAL(gfx::Image, kEmptyImage, ());
99 return kEmptyImage;
102 std::string ContentClient::GetProcessTypeNameInEnglish(int type) {
103 NOTIMPLEMENTED();
104 return std::string();
107 #if defined(OS_MACOSX) && !defined(OS_IOS)
108 bool ContentClient::GetSandboxProfileForSandboxType(
109 int sandbox_type,
110 int* sandbox_profile_resource_id) const {
111 return false;
113 #endif
115 } // namespace content