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/public/common/content_client.h" | 5 #include "content/public/common/content_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
10 #include "webkit/common/user_agent/user_agent.h" | 10 #include "webkit/common/user_agent/user_agent.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 ContentBrowserClient* rv = g_client->browser_; | 23 ContentBrowserClient* rv = g_client->browser_; |
24 g_client->browser_ = b; | 24 g_client->browser_ = b; |
25 return rv; | 25 return rv; |
26 } | 26 } |
27 | 27 |
28 static ContentRendererClient* SetRenderer(ContentRendererClient* r) { | 28 static ContentRendererClient* SetRenderer(ContentRendererClient* r) { |
29 ContentRendererClient* rv = g_client->renderer_; | 29 ContentRendererClient* rv = g_client->renderer_; |
30 g_client->renderer_ = r; | 30 g_client->renderer_ = r; |
31 return rv; | 31 return rv; |
32 } | 32 } |
| 33 |
| 34 static ContentUtilityClient* SetUtility(ContentUtilityClient* u) { |
| 35 ContentUtilityClient* rv = g_client->utility_; |
| 36 g_client->utility_ = u; |
| 37 return rv; |
| 38 } |
33 }; | 39 }; |
34 | 40 |
35 void SetContentClient(ContentClient* client) { | 41 void SetContentClient(ContentClient* client) { |
36 g_client = client; | 42 g_client = client; |
37 | 43 |
38 // Set the default user agent as provided by the client. We need to make | 44 // Set the default user agent as provided by the client. We need to make |
39 // sure this is done before webkit_glue::GetUserAgent() is called (so that | 45 // sure this is done before webkit_glue::GetUserAgent() is called (so that |
40 // the UA doesn't change). | 46 // the UA doesn't change). |
41 if (client) { | 47 if (client) { |
42 webkit_glue::SetUserAgent(client->GetUserAgent(), false); | 48 webkit_glue::SetUserAgent(client->GetUserAgent(), false); |
43 } | 49 } |
44 } | 50 } |
45 | 51 |
46 ContentClient* GetContentClient() { | 52 ContentClient* GetContentClient() { |
47 return g_client; | 53 return g_client; |
48 } | 54 } |
49 | 55 |
50 ContentBrowserClient* SetBrowserClientForTesting(ContentBrowserClient* b) { | 56 ContentBrowserClient* SetBrowserClientForTesting(ContentBrowserClient* b) { |
51 return InternalTestInitializer::SetBrowser(b); | 57 return InternalTestInitializer::SetBrowser(b); |
52 } | 58 } |
53 | 59 |
54 ContentRendererClient* SetRendererClientForTesting(ContentRendererClient* r) { | 60 ContentRendererClient* SetRendererClientForTesting(ContentRendererClient* r) { |
55 return InternalTestInitializer::SetRenderer(r); | 61 return InternalTestInitializer::SetRenderer(r); |
56 } | 62 } |
57 | 63 |
| 64 ContentUtilityClient* SetUtilityClientForTesting(ContentUtilityClient* u) { |
| 65 return InternalTestInitializer::SetUtility(u); |
| 66 } |
| 67 |
58 const std::string& GetUserAgent(const GURL& url) { | 68 const std::string& GetUserAgent(const GURL& url) { |
59 DCHECK(g_client); | 69 DCHECK(g_client); |
60 return webkit_glue::GetUserAgent(url); | 70 return webkit_glue::GetUserAgent(url); |
61 } | 71 } |
62 | 72 |
63 webkit::ppapi::HostGlobals* GetHostGlobals() { | 73 webkit::ppapi::HostGlobals* GetHostGlobals() { |
64 #if defined(ENABLE_PLUGINS) | 74 #if defined(ENABLE_PLUGINS) |
65 return webkit::ppapi::HostGlobals::Get(); | 75 return webkit::ppapi::HostGlobals::Get(); |
66 #else | 76 #else |
67 return NULL; | 77 return NULL; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 int* sandbox_profile_resource_id) const { | 132 int* sandbox_profile_resource_id) const { |
123 return false; | 133 return false; |
124 } | 134 } |
125 | 135 |
126 std::string ContentClient::GetCarbonInterposePath() const { | 136 std::string ContentClient::GetCarbonInterposePath() const { |
127 return std::string(); | 137 return std::string(); |
128 } | 138 } |
129 #endif | 139 #endif |
130 | 140 |
131 } // namespace content | 141 } // namespace content |
OLD | NEW |