| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_CONTENT_CLIENT_H_ | 5 #ifndef CONTENT_COMMON_CONTENT_CLIENT_H_ |
| 6 #define CONTENT_COMMON_CONTENT_CLIENT_H_ | 6 #define CONTENT_COMMON_CONTENT_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 struct GPUInfo; | 15 struct GPUInfo; |
| 16 struct PepperPluginInfo; | 16 struct PepperPluginInfo; |
| 17 | 17 |
| 18 namespace IPC { | 18 namespace IPC { |
| 19 class Message; | 19 class Message; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 class ContentBrowserClient; | 24 class ContentBrowserClient; |
| 25 class ContentClient; | 25 class ContentClient; |
| 26 class ContentPluginClient; | 26 class ContentPluginClient; |
| 27 class ContentRendererClient; | 27 class ContentRendererClient; |
| 28 class ContentWorkerClient; |
| 28 | 29 |
| 29 // Setter and getter for the client. The client should be set early, before any | 30 // Setter and getter for the client. The client should be set early, before any |
| 30 // content code is called. | 31 // content code is called. |
| 31 void SetContentClient(ContentClient* client); | 32 void SetContentClient(ContentClient* client); |
| 32 ContentClient* GetContentClient(); | 33 ContentClient* GetContentClient(); |
| 33 | 34 |
| 34 // Interface that the embedder implements. | 35 // Interface that the embedder implements. |
| 35 class ContentClient { | 36 class ContentClient { |
| 36 public: | 37 public: |
| 37 ContentClient(); | 38 ContentClient(); |
| 38 ~ContentClient(); | 39 ~ContentClient(); |
| 39 | 40 |
| 40 ContentBrowserClient* browser() { return browser_; } | 41 ContentBrowserClient* browser() { return browser_; } |
| 41 void set_browser(ContentBrowserClient* c) { browser_ = c; } | 42 void set_browser(ContentBrowserClient* c) { browser_ = c; } |
| 42 ContentPluginClient* plugin() { return plugin_; } | 43 ContentPluginClient* plugin() { return plugin_; } |
| 43 void set_plugin(ContentPluginClient* r) { plugin_ = r; } | 44 void set_plugin(ContentPluginClient* r) { plugin_ = r; } |
| 44 ContentRendererClient* renderer() { return renderer_; } | 45 ContentRendererClient* renderer() { return renderer_; } |
| 45 void set_renderer(ContentRendererClient* r) { renderer_ = r; } | 46 void set_renderer(ContentRendererClient* r) { renderer_ = r; } |
| 47 ContentWorkerClient* worker() { return worker_; } |
| 48 void set_worker(ContentWorkerClient* r) { worker_ = r; } |
| 46 | 49 |
| 47 // Sets the currently active URL. Use GURL() to clear the URL. | 50 // Sets the currently active URL. Use GURL() to clear the URL. |
| 48 virtual void SetActiveURL(const GURL& url) {} | 51 virtual void SetActiveURL(const GURL& url) {} |
| 49 | 52 |
| 50 // Sets the data on the current gpu. | 53 // Sets the data on the current gpu. |
| 51 virtual void SetGpuInfo(const GPUInfo& gpu_info) {} | 54 virtual void SetGpuInfo(const GPUInfo& gpu_info) {} |
| 52 | 55 |
| 53 // Gives the embedder a chance to register its own pepper plugins. | 56 // Gives the embedder a chance to register its own pepper plugins. |
| 54 virtual void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) {} | 57 virtual void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) {} |
| 55 | 58 |
| 56 // Returns whether the given message should be allowed to be sent from a | 59 // Returns whether the given message should be allowed to be sent from a |
| 57 // swapped out renderer. | 60 // swapped out renderer. |
| 58 virtual bool CanSendWhileSwappedOut(const IPC::Message* msg); | 61 virtual bool CanSendWhileSwappedOut(const IPC::Message* msg); |
| 59 | 62 |
| 60 // Returns whether the given message should be processed in the browser on | 63 // Returns whether the given message should be processed in the browser on |
| 61 // behalf of a swapped out renderer. | 64 // behalf of a swapped out renderer. |
| 62 virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg); | 65 virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg); |
| 63 | 66 |
| 64 private: | 67 private: |
| 65 // The embedder API for participating in browser logic. | 68 // The embedder API for participating in browser logic. |
| 66 ContentBrowserClient* browser_; | 69 ContentBrowserClient* browser_; |
| 67 // The embedder API for participating in plugin logic. | 70 // The embedder API for participating in plugin logic. |
| 68 ContentPluginClient* plugin_; | 71 ContentPluginClient* plugin_; |
| 69 // The embedder API for participating in renderer logic. | 72 // The embedder API for participating in renderer logic. |
| 70 ContentRendererClient* renderer_; | 73 ContentRendererClient* renderer_; |
| 74 // The embedder API for participating in worker logic. |
| 75 ContentWorkerClient* worker_; |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace content | 78 } // namespace content |
| 74 | 79 |
| 75 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ | 80 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ |
| OLD | NEW |