| 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" |
| 10 #include "content/browser/content_browser_client.h" | 11 #include "content/browser/content_browser_client.h" |
| 11 | 12 |
| 12 class GURL; | 13 class GURL; |
| 13 struct GPUInfo; | 14 struct GPUInfo; |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 class ContentClient; | 18 class ContentClient; |
| 18 // Setter and getter for the client. The client should be set early, before any | 19 // Setter and getter for the client. The client should be set early, before any |
| 19 // content code is called. | 20 // content code is called. |
| 20 void SetContentClient(ContentClient* client); | 21 void SetContentClient(ContentClient* client); |
| 21 ContentClient* GetContentClient(); | 22 ContentClient* GetContentClient(); |
| 22 | 23 |
| 23 // Interface that the embedder implements. | 24 // Interface that the embedder implements. |
| 24 class ContentClient { | 25 class ContentClient { |
| 25 public: | 26 public: |
| 26 ContentClient(); | 27 ContentClient(); |
| 27 | 28 |
| 28 // Gets or sets the embedder API for participating in browser logic. | 29 // Gets or sets the embedder API for participating in browser logic. |
| 29 // The client must be set early, before any content code is called. | 30 // The client must be set early, before any content code is called. |
| 30 ContentBrowserClient* browser_client() { | 31 ContentBrowserClient* browser_client() { |
| 31 return browser_client_; | 32 return browser_client_.get(); |
| 32 } | 33 } |
| 33 void set_browser_client(ContentBrowserClient* client) { | 34 void set_browser_client(ContentBrowserClient* client) { |
| 34 browser_client_ = client; | 35 browser_client_.reset(client); |
| 35 } | 36 } |
| 36 | 37 |
| 37 // Sets the URL that is logged if the child process crashes. Use GURL() to | 38 // Sets the URL that is logged if the child process crashes. Use GURL() to |
| 38 // clear the URL. | 39 // clear the URL. |
| 39 virtual void SetActiveURL(const GURL& url) {} | 40 virtual void SetActiveURL(const GURL& url) {} |
| 40 | 41 |
| 41 // Sets the data on the gpu to send along with crash reports. | 42 // Sets the data on the gpu to send along with crash reports. |
| 42 virtual void SetGpuInfo(const GPUInfo& gpu_info) {} | 43 virtual void SetGpuInfo(const GPUInfo& gpu_info) {} |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 ContentBrowserClient* browser_client_; | 46 scoped_ptr<ContentBrowserClient> browser_client_; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace content | 49 } // namespace content |
| 49 | 50 |
| 50 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ | 51 #endif // CONTENT_COMMON_CONTENT_CLIENT_H_ |
| OLD | NEW |