| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "base/string16.h" | |
| 12 | 10 |
| 13 class ContentBrowserClient; | |
| 14 class GURL; | 11 class GURL; |
| 15 struct GPUInfo; | |
| 16 | 12 |
| 17 namespace content { | 13 namespace content { |
| 18 | 14 |
| 15 class ContentBrowserClient; |
| 19 class ContentClient; | 16 class ContentClient; |
| 17 class ContentGpuClient; |
| 18 class ContentPluginClient; |
| 19 class ContentRendererClient; |
| 20 |
| 20 // Setter and getter for the client. The client should be set early, before any | 21 // Setter and getter for the client. The client should be set early, before any |
| 21 // content code is called. | 22 // content code is called. |
| 22 void SetContentClient(ContentClient* client); | 23 void SetContentClient(ContentClient* client); |
| 23 ContentClient* GetContentClient(); | 24 ContentClient* GetContentClient(); |
| 24 | 25 |
| 25 // Interface that the embedder implements. | 26 // Interface that the embedder implements. |
| 26 class ContentClient { | 27 class ContentClient { |
| 27 public: | 28 public: |
| 28 ContentClient(); | 29 ContentClient(); |
| 29 ~ContentClient(); | 30 ~ContentClient(); |
| 30 | 31 |
| 31 // Gets or sets the embedder API for participating in browser logic. | 32 ContentBrowserClient* browser() { return browser_; } |
| 32 // The client must be set early, before any content code is called. | 33 void set_browser(ContentBrowserClient* c) { browser_ = c; } |
| 33 ContentBrowserClient* browser_client() { | 34 ContentGpuClient* gpu() { return gpu_; } |
| 34 return browser_client_; | 35 void set_gpu(ContentGpuClient* g) { gpu_ = g; } |
| 35 } | 36 ContentPluginClient* plugin() { return plugin_; } |
| 36 void set_browser_client(ContentBrowserClient* client) { | 37 void set_plugin(ContentPluginClient* r) { plugin_ = r; } |
| 37 browser_client_ = client; | 38 ContentRendererClient* renderer() { return renderer_; } |
| 38 } | 39 void set_renderer(ContentRendererClient* r) { renderer_ = r; } |
| 39 | 40 |
| 40 // Sets the URL that is logged if the child process crashes. Use GURL() to | 41 // Sets the URL that is logged if the child process crashes. Use GURL() to |
| 41 // clear the URL. | 42 // clear the URL. |
| 42 virtual void SetActiveURL(const GURL& url) {} | 43 virtual void SetActiveURL(const GURL& url) {} |
| 43 | 44 |
| 44 // Sets the data on the gpu to send along with crash reports. | |
| 45 virtual void SetGpuInfo(const GPUInfo& gpu_info) {} | |
| 46 | |
| 47 // Notifies that a plugin process has started. | |
| 48 virtual void PluginProcessStarted(const string16& plugin_name) {} | |
| 49 | |
| 50 private: | 45 private: |
| 51 ContentBrowserClient* browser_client_; | 46 // The embedder API for participating in browser logic. |
| 47 ContentBrowserClient* browser_; |
| 48 // The embedder API for participating in gpu logic. |
| 49 ContentGpuClient* gpu_; |
| 50 // The embedder API for participating in plugin logic. |
| 51 ContentPluginClient* plugin_; |
| 52 // The embedder API for participating in renderer logic. |
| 53 ContentRendererClient* renderer_; |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 } // namespace content | 56 } // namespace content |
| 55 | 57 |
| 56 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ | 58 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ |
| OLD | NEW |