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 #ifndef CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ |
6 #define CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ | 6 #define CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class ContentClient; | 50 class ContentClient; |
51 class ContentPluginClient; | 51 class ContentPluginClient; |
52 class ContentRendererClient; | 52 class ContentRendererClient; |
53 class ContentUtilityClient; | 53 class ContentUtilityClient; |
54 struct GPUInfo; | 54 struct GPUInfo; |
55 struct PepperPluginInfo; | 55 struct PepperPluginInfo; |
56 | 56 |
57 // Setter and getter for the client. The client should be set early, before any | 57 // Setter and getter for the client. The client should be set early, before any |
58 // content code is called. | 58 // content code is called. |
59 CONTENT_EXPORT void SetContentClient(ContentClient* client); | 59 CONTENT_EXPORT void SetContentClient(ContentClient* client); |
60 CONTENT_EXPORT ContentClient* GetContentClient(); | 60 |
| 61 #if defined(CONTENT_IMPLEMENTATION) |
| 62 // Content's embedder API should only be used by content. |
| 63 ContentClient* GetContentClient(); |
| 64 #endif |
| 65 |
| 66 // Used for tests to override the relevant embedder interfaces. Each method |
| 67 // returns the old value. |
| 68 CONTENT_EXPORT ContentBrowserClient* SetBrowserClientForTesting( |
| 69 ContentBrowserClient* b); |
| 70 CONTENT_EXPORT ContentRendererClient* SetRendererClientForTesting( |
| 71 ContentRendererClient* r); |
61 | 72 |
62 // Returns the user agent string being used by the browser. SetContentClient() | 73 // Returns the user agent string being used by the browser. SetContentClient() |
63 // must be called prior to calling this, and this routine must be used | 74 // must be called prior to calling this, and this routine must be used |
64 // instead of webkit_glue::GetUserAgent() in order to ensure that we use | 75 // instead of webkit_glue::GetUserAgent() in order to ensure that we use |
65 // the same user agent string everywhere. | 76 // the same user agent string everywhere. |
66 // TODO(dpranke): This is caused by webkit_glue being a library that can | 77 // TODO(dpranke): This is caused by webkit_glue being a library that can |
67 // get linked into multiple linkable objects, causing us to have multiple | 78 // get linked into multiple linkable objects, causing us to have multiple |
68 // static values of the user agent. This will be fixed when we clean up | 79 // static values of the user agent. This will be fixed when we clean up |
69 // webkit_glue. | 80 // webkit_glue. |
70 CONTENT_EXPORT const std::string& GetUserAgent(const GURL& url); | 81 CONTENT_EXPORT const std::string& GetUserAgent(const GURL& url); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // the sandbox profile to use and true is returned. | 158 // the sandbox profile to use and true is returned. |
148 virtual bool GetSandboxProfileForSandboxType( | 159 virtual bool GetSandboxProfileForSandboxType( |
149 int sandbox_type, | 160 int sandbox_type, |
150 int* sandbox_profile_resource_id) const; | 161 int* sandbox_profile_resource_id) const; |
151 | 162 |
152 // Gets the Carbon interposing path to give to DYLD. Returns an empty string | 163 // Gets the Carbon interposing path to give to DYLD. Returns an empty string |
153 // if the embedder doesn't bundle it. | 164 // if the embedder doesn't bundle it. |
154 virtual std::string GetCarbonInterposePath() const; | 165 virtual std::string GetCarbonInterposePath() const; |
155 #endif | 166 #endif |
156 | 167 |
157 void set_browser_for_testing(ContentBrowserClient* c) { browser_ = c; } | |
158 void set_renderer_for_testing(ContentRendererClient* r) { renderer_ = r; } | |
159 | |
160 private: | 168 private: |
161 friend class ContentClientInitializer; // To set these pointers. | 169 friend class ContentClientInitializer; // To set these pointers. |
| 170 friend class InternalTestInitializer; |
162 | 171 |
163 // The embedder API for participating in browser logic. | 172 // The embedder API for participating in browser logic. |
164 ContentBrowserClient* browser_; | 173 ContentBrowserClient* browser_; |
165 // The embedder API for participating in plugin logic. | 174 // The embedder API for participating in plugin logic. |
166 ContentPluginClient* plugin_; | 175 ContentPluginClient* plugin_; |
167 // The embedder API for participating in renderer logic. | 176 // The embedder API for participating in renderer logic. |
168 ContentRendererClient* renderer_; | 177 ContentRendererClient* renderer_; |
169 // The embedder API for participating in utility logic. | 178 // The embedder API for participating in utility logic. |
170 ContentUtilityClient* utility_; | 179 ContentUtilityClient* utility_; |
171 }; | 180 }; |
172 | 181 |
173 } // namespace content | 182 } // namespace content |
174 | 183 |
175 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ | 184 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ |
OLD | NEW |