OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ | 5 #ifndef CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ |
6 #define CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ | 6 #define CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 | 13 |
13 class PrefService; | 14 class PrefService; |
14 | 15 |
15 namespace breakpad { | 16 namespace breakpad { |
16 class CrashDumpManager; | 17 class CrashDumpManager; |
17 } // namespace breakpad | 18 } // namespace breakpad |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 class NetLog; | 21 class NetLog; |
(...skipping 17 matching lines...) Expand all Loading... |
38 | 39 |
39 class CastBrowserProcess { | 40 class CastBrowserProcess { |
40 public: | 41 public: |
41 // Gets the global instance of CastBrowserProcess. Does not create lazily and | 42 // Gets the global instance of CastBrowserProcess. Does not create lazily and |
42 // assumes the instance already exists. | 43 // assumes the instance already exists. |
43 static CastBrowserProcess* GetInstance(); | 44 static CastBrowserProcess* GetInstance(); |
44 | 45 |
45 CastBrowserProcess(); | 46 CastBrowserProcess(); |
46 virtual ~CastBrowserProcess(); | 47 virtual ~CastBrowserProcess(); |
47 | 48 |
48 void SetBrowserContext(scoped_ptr<CastBrowserContext> browser_context); | 49 void SetBrowserContext(std::unique_ptr<CastBrowserContext> browser_context); |
49 void SetCastContentBrowserClient(CastContentBrowserClient* browser_client); | 50 void SetCastContentBrowserClient(CastContentBrowserClient* browser_client); |
50 void SetCastService(scoped_ptr<CastService> cast_service); | 51 void SetCastService(std::unique_ptr<CastService> cast_service); |
51 #if defined(USE_AURA) | 52 #if defined(USE_AURA) |
52 void SetCastScreen(scoped_ptr<CastScreen> cast_screen); | 53 void SetCastScreen(std::unique_ptr<CastScreen> cast_screen); |
53 #endif // defined(USE_AURA) | 54 #endif // defined(USE_AURA) |
54 void SetMetricsHelper(scoped_ptr<metrics::CastMetricsHelper> metrics_helper); | 55 void SetMetricsHelper( |
| 56 std::unique_ptr<metrics::CastMetricsHelper> metrics_helper); |
55 void SetMetricsServiceClient( | 57 void SetMetricsServiceClient( |
56 scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client); | 58 std::unique_ptr<metrics::CastMetricsServiceClient> |
57 void SetPrefService(scoped_ptr<PrefService> pref_service); | 59 metrics_service_client); |
| 60 void SetPrefService(std::unique_ptr<PrefService> pref_service); |
58 void SetRemoteDebuggingServer( | 61 void SetRemoteDebuggingServer( |
59 scoped_ptr<RemoteDebuggingServer> remote_debugging_server); | 62 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server); |
60 void SetResourceDispatcherHostDelegate( | 63 void SetResourceDispatcherHostDelegate( |
61 scoped_ptr<CastResourceDispatcherHostDelegate> delegate); | 64 std::unique_ptr<CastResourceDispatcherHostDelegate> delegate); |
62 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
63 void SetCrashDumpManager( | 66 void SetCrashDumpManager( |
64 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager); | 67 std::unique_ptr<breakpad::CrashDumpManager> crash_dump_manager); |
65 #endif // defined(OS_ANDROID) | 68 #endif // defined(OS_ANDROID) |
66 void SetConnectivityChecker( | 69 void SetConnectivityChecker( |
67 scoped_refptr<ConnectivityChecker> connectivity_checker); | 70 scoped_refptr<ConnectivityChecker> connectivity_checker); |
68 void SetNetLog(net::NetLog* net_log); | 71 void SetNetLog(net::NetLog* net_log); |
69 | 72 |
70 CastContentBrowserClient* browser_client() const { | 73 CastContentBrowserClient* browser_client() const { |
71 return cast_content_browser_client_; | 74 return cast_content_browser_client_; |
72 } | 75 } |
73 CastBrowserContext* browser_context() const { return browser_context_.get(); } | 76 CastBrowserContext* browser_context() const { return browser_context_.get(); } |
74 CastService* cast_service() const { return cast_service_.get(); } | 77 CastService* cast_service() const { return cast_service_.get(); } |
75 #if defined(USE_AURA) | 78 #if defined(USE_AURA) |
76 CastScreen* cast_screen() const { return cast_screen_.get(); } | 79 CastScreen* cast_screen() const { return cast_screen_.get(); } |
77 #endif // defined(USE_AURA) | 80 #endif // defined(USE_AURA) |
78 metrics::CastMetricsServiceClient* metrics_service_client() const { | 81 metrics::CastMetricsServiceClient* metrics_service_client() const { |
79 return metrics_service_client_.get(); | 82 return metrics_service_client_.get(); |
80 } | 83 } |
81 PrefService* pref_service() const { return pref_service_.get(); } | 84 PrefService* pref_service() const { return pref_service_.get(); } |
82 CastResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() | 85 CastResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() |
83 const { | 86 const { |
84 return resource_dispatcher_host_delegate_.get(); | 87 return resource_dispatcher_host_delegate_.get(); |
85 } | 88 } |
86 ConnectivityChecker* connectivity_checker() const { | 89 ConnectivityChecker* connectivity_checker() const { |
87 return connectivity_checker_.get(); | 90 return connectivity_checker_.get(); |
88 } | 91 } |
89 net::NetLog* net_log() const { return net_log_; } | 92 net::NetLog* net_log() const { return net_log_; } |
90 | 93 |
91 private: | 94 private: |
92 // Note: The following order should match the order they are set in | 95 // Note: The following order should match the order they are set in |
93 // CastBrowserMainParts. | 96 // CastBrowserMainParts. |
94 scoped_ptr<metrics::CastMetricsHelper> metrics_helper_; | 97 std::unique_ptr<metrics::CastMetricsHelper> metrics_helper_; |
95 #if defined(USE_AURA) | 98 #if defined(USE_AURA) |
96 scoped_ptr<CastScreen> cast_screen_; | 99 std::unique_ptr<CastScreen> cast_screen_; |
97 #endif // defined(USE_AURA) | 100 #endif // defined(USE_AURA) |
98 scoped_ptr<PrefService> pref_service_; | 101 std::unique_ptr<PrefService> pref_service_; |
99 scoped_refptr<ConnectivityChecker> connectivity_checker_; | 102 scoped_refptr<ConnectivityChecker> connectivity_checker_; |
100 scoped_ptr<CastBrowserContext> browser_context_; | 103 std::unique_ptr<CastBrowserContext> browser_context_; |
101 scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client_; | 104 std::unique_ptr<metrics::CastMetricsServiceClient> metrics_service_client_; |
102 scoped_ptr<CastResourceDispatcherHostDelegate> | 105 std::unique_ptr<CastResourceDispatcherHostDelegate> |
103 resource_dispatcher_host_delegate_; | 106 resource_dispatcher_host_delegate_; |
104 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
105 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_; | 108 std::unique_ptr<breakpad::CrashDumpManager> crash_dump_manager_; |
106 #endif // defined(OS_ANDROID) | 109 #endif // defined(OS_ANDROID) |
107 scoped_ptr<RemoteDebuggingServer> remote_debugging_server_; | 110 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_; |
108 | 111 |
109 CastContentBrowserClient* cast_content_browser_client_; | 112 CastContentBrowserClient* cast_content_browser_client_; |
110 net::NetLog* net_log_; | 113 net::NetLog* net_log_; |
111 | 114 |
112 // Note: CastService must be destroyed before others. | 115 // Note: CastService must be destroyed before others. |
113 scoped_ptr<CastService> cast_service_; | 116 std::unique_ptr<CastService> cast_service_; |
114 | 117 |
115 DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess); | 118 DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess); |
116 }; | 119 }; |
117 | 120 |
118 } // namespace shell | 121 } // namespace shell |
119 } // namespace chromecast | 122 } // namespace chromecast |
120 | 123 |
121 #endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ | 124 #endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ |
OLD | NEW |