| 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 #include "chromecast/browser/cast_browser_process.h" | 5 #include "chromecast/browser/cast_browser_process.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 CastBrowserProcess::~CastBrowserProcess() { | 48 CastBrowserProcess::~CastBrowserProcess() { |
| 49 DCHECK_EQ(g_instance, this); | 49 DCHECK_EQ(g_instance, this); |
| 50 if (pref_service_) | 50 if (pref_service_) |
| 51 pref_service_->CommitPendingWrite(); | 51 pref_service_->CommitPendingWrite(); |
| 52 g_instance = NULL; | 52 g_instance = NULL; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void CastBrowserProcess::SetBrowserContext( | 55 void CastBrowserProcess::SetBrowserContext( |
| 56 scoped_ptr<CastBrowserContext> browser_context) { | 56 std::unique_ptr<CastBrowserContext> browser_context) { |
| 57 DCHECK(!browser_context_); | 57 DCHECK(!browser_context_); |
| 58 browser_context_.swap(browser_context); | 58 browser_context_.swap(browser_context); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CastBrowserProcess::SetCastContentBrowserClient( | 61 void CastBrowserProcess::SetCastContentBrowserClient( |
| 62 CastContentBrowserClient* cast_content_browser_client) { | 62 CastContentBrowserClient* cast_content_browser_client) { |
| 63 DCHECK(!cast_content_browser_client_); | 63 DCHECK(!cast_content_browser_client_); |
| 64 cast_content_browser_client_ = cast_content_browser_client; | 64 cast_content_browser_client_ = cast_content_browser_client; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void CastBrowserProcess::SetCastService(scoped_ptr<CastService> cast_service) { | 67 void CastBrowserProcess::SetCastService( |
| 68 std::unique_ptr<CastService> cast_service) { |
| 68 DCHECK(!cast_service_); | 69 DCHECK(!cast_service_); |
| 69 cast_service_.swap(cast_service); | 70 cast_service_.swap(cast_service); |
| 70 } | 71 } |
| 71 | 72 |
| 72 #if defined(USE_AURA) | 73 #if defined(USE_AURA) |
| 73 void CastBrowserProcess::SetCastScreen(scoped_ptr<CastScreen> cast_screen) { | 74 void CastBrowserProcess::SetCastScreen( |
| 75 std::unique_ptr<CastScreen> cast_screen) { |
| 74 DCHECK(!cast_screen_); | 76 DCHECK(!cast_screen_); |
| 75 cast_screen_ = std::move(cast_screen); | 77 cast_screen_ = std::move(cast_screen); |
| 76 } | 78 } |
| 77 #endif // defined(USE_AURA) | 79 #endif // defined(USE_AURA) |
| 78 | 80 |
| 79 void CastBrowserProcess::SetMetricsHelper( | 81 void CastBrowserProcess::SetMetricsHelper( |
| 80 scoped_ptr<metrics::CastMetricsHelper> metrics_helper) { | 82 std::unique_ptr<metrics::CastMetricsHelper> metrics_helper) { |
| 81 DCHECK(!metrics_helper_); | 83 DCHECK(!metrics_helper_); |
| 82 metrics_helper_.swap(metrics_helper); | 84 metrics_helper_.swap(metrics_helper); |
| 83 } | 85 } |
| 84 | 86 |
| 85 void CastBrowserProcess::SetMetricsServiceClient( | 87 void CastBrowserProcess::SetMetricsServiceClient( |
| 86 scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client) { | 88 std::unique_ptr<metrics::CastMetricsServiceClient> metrics_service_client) { |
| 87 DCHECK(!metrics_service_client_); | 89 DCHECK(!metrics_service_client_); |
| 88 metrics_service_client_.swap(metrics_service_client); | 90 metrics_service_client_.swap(metrics_service_client); |
| 89 } | 91 } |
| 90 | 92 |
| 91 void CastBrowserProcess::SetPrefService(scoped_ptr<PrefService> pref_service) { | 93 void CastBrowserProcess::SetPrefService( |
| 94 std::unique_ptr<PrefService> pref_service) { |
| 92 DCHECK(!pref_service_); | 95 DCHECK(!pref_service_); |
| 93 pref_service_.swap(pref_service); | 96 pref_service_.swap(pref_service); |
| 94 } | 97 } |
| 95 | 98 |
| 96 void CastBrowserProcess::SetRemoteDebuggingServer( | 99 void CastBrowserProcess::SetRemoteDebuggingServer( |
| 97 scoped_ptr<RemoteDebuggingServer> remote_debugging_server) { | 100 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server) { |
| 98 DCHECK(!remote_debugging_server_); | 101 DCHECK(!remote_debugging_server_); |
| 99 remote_debugging_server_.swap(remote_debugging_server); | 102 remote_debugging_server_.swap(remote_debugging_server); |
| 100 } | 103 } |
| 101 | 104 |
| 102 void CastBrowserProcess::SetResourceDispatcherHostDelegate( | 105 void CastBrowserProcess::SetResourceDispatcherHostDelegate( |
| 103 scoped_ptr<CastResourceDispatcherHostDelegate> delegate) { | 106 std::unique_ptr<CastResourceDispatcherHostDelegate> delegate) { |
| 104 DCHECK(!resource_dispatcher_host_delegate_); | 107 DCHECK(!resource_dispatcher_host_delegate_); |
| 105 resource_dispatcher_host_delegate_.swap(delegate); | 108 resource_dispatcher_host_delegate_.swap(delegate); |
| 106 } | 109 } |
| 107 | 110 |
| 108 #if defined(OS_ANDROID) | 111 #if defined(OS_ANDROID) |
| 109 void CastBrowserProcess::SetCrashDumpManager( | 112 void CastBrowserProcess::SetCrashDumpManager( |
| 110 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager) { | 113 std::unique_ptr<breakpad::CrashDumpManager> crash_dump_manager) { |
| 111 DCHECK(!crash_dump_manager_); | 114 DCHECK(!crash_dump_manager_); |
| 112 crash_dump_manager_.swap(crash_dump_manager); | 115 crash_dump_manager_.swap(crash_dump_manager); |
| 113 } | 116 } |
| 114 #endif // defined(OS_ANDROID) | 117 #endif // defined(OS_ANDROID) |
| 115 | 118 |
| 116 void CastBrowserProcess::SetConnectivityChecker( | 119 void CastBrowserProcess::SetConnectivityChecker( |
| 117 scoped_refptr<ConnectivityChecker> connectivity_checker) { | 120 scoped_refptr<ConnectivityChecker> connectivity_checker) { |
| 118 DCHECK(!connectivity_checker_); | 121 DCHECK(!connectivity_checker_); |
| 119 connectivity_checker_.swap(connectivity_checker); | 122 connectivity_checker_.swap(connectivity_checker); |
| 120 } | 123 } |
| 121 | 124 |
| 122 void CastBrowserProcess::SetNetLog(net::NetLog* net_log) { | 125 void CastBrowserProcess::SetNetLog(net::NetLog* net_log) { |
| 123 DCHECK(!net_log_); | 126 DCHECK(!net_log_); |
| 124 net_log_ = net_log; | 127 net_log_ = net_log; |
| 125 } | 128 } |
| 126 | 129 |
| 127 } // namespace shell | 130 } // namespace shell |
| 128 } // namespace chromecast | 131 } // namespace chromecast |
| OLD | NEW |