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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // TODO(dpranke): Also needed since webkit_glue is a library. | 66 // TODO(dpranke): Also needed since webkit_glue is a library. |
67 CONTENT_EXPORT webkit::ppapi::HostGlobals* GetHostGlobals(); | 67 CONTENT_EXPORT webkit::ppapi::HostGlobals* GetHostGlobals(); |
68 | 68 |
69 // Interface that the embedder implements. | 69 // Interface that the embedder implements. |
70 class CONTENT_EXPORT ContentClient { | 70 class CONTENT_EXPORT ContentClient { |
71 public: | 71 public: |
72 ContentClient(); | 72 ContentClient(); |
73 virtual ~ContentClient(); | 73 virtual ~ContentClient(); |
74 | 74 |
75 ContentBrowserClient* browser() { return browser_; } | 75 ContentBrowserClient* browser() { return browser_; } |
76 void set_browser(ContentBrowserClient* c) { browser_ = c; } | |
77 ContentPluginClient* plugin() { return plugin_; } | 76 ContentPluginClient* plugin() { return plugin_; } |
78 void set_plugin(ContentPluginClient* p) { plugin_ = p; } | |
79 ContentRendererClient* renderer() { return renderer_; } | 77 ContentRendererClient* renderer() { return renderer_; } |
80 void set_renderer(ContentRendererClient* r) { renderer_ = r; } | |
81 ContentUtilityClient* utility() { return utility_; } | 78 ContentUtilityClient* utility() { return utility_; } |
82 void set_utility(ContentUtilityClient* u) { utility_ = u; } | |
83 | 79 |
84 // Sets the currently active URL. Use GURL() to clear the URL. | 80 // Sets the currently active URL. Use GURL() to clear the URL. |
85 virtual void SetActiveURL(const GURL& url) {} | 81 virtual void SetActiveURL(const GURL& url) {} |
86 | 82 |
87 // Sets the data on the current gpu. | 83 // Sets the data on the current gpu. |
88 virtual void SetGpuInfo(const content::GPUInfo& gpu_info) {} | 84 virtual void SetGpuInfo(const content::GPUInfo& gpu_info) {} |
89 | 85 |
90 // Gives the embedder a chance to register its own pepper plugins. | 86 // Gives the embedder a chance to register its own pepper plugins. |
91 virtual void AddPepperPlugins( | 87 virtual void AddPepperPlugins( |
92 std::vector<content::PepperPluginInfo>* plugins) {} | 88 std::vector<content::PepperPluginInfo>* plugins) {} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // for |sandbox_type| are defined by the embedder and should start with | 128 // for |sandbox_type| are defined by the embedder and should start with |
133 // SandboxType::SANDBOX_TYPE_AFTER_LAST_TYPE. Returns false if no sandbox | 129 // SandboxType::SANDBOX_TYPE_AFTER_LAST_TYPE. Returns false if no sandbox |
134 // profile for the given |sandbox_type| exists. Otherwise, | 130 // profile for the given |sandbox_type| exists. Otherwise, |
135 // |sandbox_profile_resource_id| is set to the resource ID corresponding to | 131 // |sandbox_profile_resource_id| is set to the resource ID corresponding to |
136 // the sandbox profile to use and true is returned. | 132 // the sandbox profile to use and true is returned. |
137 virtual bool GetSandboxProfileForSandboxType( | 133 virtual bool GetSandboxProfileForSandboxType( |
138 int sandbox_type, | 134 int sandbox_type, |
139 int* sandbox_profile_resource_id) const; | 135 int* sandbox_profile_resource_id) const; |
140 #endif | 136 #endif |
141 | 137 |
| 138 void set_browser_for_testing(ContentBrowserClient* c) { browser_ = c; } |
| 139 void set_renderer_for_testing(ContentRendererClient* r) { renderer_ = r; } |
| 140 |
142 private: | 141 private: |
| 142 friend class ContentClientInitializer; // To set these pointers. |
| 143 |
143 // The embedder API for participating in browser logic. | 144 // The embedder API for participating in browser logic. |
144 ContentBrowserClient* browser_; | 145 ContentBrowserClient* browser_; |
145 // The embedder API for participating in plugin logic. | 146 // The embedder API for participating in plugin logic. |
146 ContentPluginClient* plugin_; | 147 ContentPluginClient* plugin_; |
147 // The embedder API for participating in renderer logic. | 148 // The embedder API for participating in renderer logic. |
148 ContentRendererClient* renderer_; | 149 ContentRendererClient* renderer_; |
149 // The embedder API for participating in utility logic. | 150 // The embedder API for participating in utility logic. |
150 ContentUtilityClient* utility_; | 151 ContentUtilityClient* utility_; |
151 }; | 152 }; |
152 | 153 |
153 } // namespace content | 154 } // namespace content |
154 | 155 |
155 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ | 156 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ |
OLD | NEW |