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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chromecast/base/metrics/cast_metrics_helper.h" | 9 #include "chromecast/base/metrics/cast_metrics_helper.h" |
10 #include "chromecast/browser/cast_browser_context.h" | 10 #include "chromecast/browser/cast_browser_context.h" |
11 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 11 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
12 #include "chromecast/browser/devtools/remote_debugging_server.h" | 12 #include "chromecast/browser/devtools/remote_debugging_server.h" |
13 #include "chromecast/browser/metrics/cast_metrics_service_client.h" | 13 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
14 #include "chromecast/browser/service/cast_service.h" | 14 #include "chromecast/browser/service/cast_service.h" |
15 #include "chromecast/net/connectivity_checker.h" | 15 #include "chromecast/net/connectivity_checker.h" |
16 | 16 |
17 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
18 #include "components/crash/browser/crash_dump_manager_android.h" | 18 #include "components/crash/browser/crash_dump_manager_android.h" |
19 #endif // defined(OS_ANDROID) | 19 #endif // defined(OS_ANDROID) |
20 | 20 |
21 #if defined(USE_AURA) | |
22 #include "ui/aura/env.h" | |
23 #endif | |
24 | |
25 namespace chromecast { | 21 namespace chromecast { |
26 namespace shell { | 22 namespace shell { |
27 | 23 |
28 namespace { | 24 namespace { |
29 CastBrowserProcess* g_instance = NULL; | 25 CastBrowserProcess* g_instance = NULL; |
30 } // namespace | 26 } // namespace |
31 | 27 |
32 // static | 28 // static |
33 CastBrowserProcess* CastBrowserProcess::GetInstance() { | 29 CastBrowserProcess* CastBrowserProcess::GetInstance() { |
34 DCHECK(g_instance); | 30 DCHECK(g_instance); |
35 return g_instance; | 31 return g_instance; |
36 } | 32 } |
37 | 33 |
38 CastBrowserProcess::CastBrowserProcess() { | 34 CastBrowserProcess::CastBrowserProcess() { |
39 DCHECK(!g_instance); | 35 DCHECK(!g_instance); |
40 g_instance = this; | 36 g_instance = this; |
41 } | 37 } |
42 | 38 |
43 CastBrowserProcess::~CastBrowserProcess() { | 39 CastBrowserProcess::~CastBrowserProcess() { |
44 DCHECK_EQ(g_instance, this); | 40 DCHECK_EQ(g_instance, this); |
45 if (pref_service_) | 41 if (pref_service_) |
46 pref_service_->CommitPendingWrite(); | 42 pref_service_->CommitPendingWrite(); |
47 #if defined(USE_AURA) | |
48 aura::Env::DeleteInstance(); | |
49 #endif | |
50 g_instance = NULL; | 43 g_instance = NULL; |
51 } | 44 } |
52 | 45 |
53 void CastBrowserProcess::SetBrowserContext( | 46 void CastBrowserProcess::SetBrowserContext( |
54 scoped_ptr<CastBrowserContext> browser_context) { | 47 scoped_ptr<CastBrowserContext> browser_context) { |
55 DCHECK(!browser_context_); | 48 DCHECK(!browser_context_); |
56 browser_context_.swap(browser_context); | 49 browser_context_.swap(browser_context); |
57 } | 50 } |
58 | 51 |
59 void CastBrowserProcess::SetCastService(scoped_ptr<CastService> cast_service) { | 52 void CastBrowserProcess::SetCastService(scoped_ptr<CastService> cast_service) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #endif // defined(OS_ANDROID) | 92 #endif // defined(OS_ANDROID) |
100 | 93 |
101 void CastBrowserProcess::SetConnectivityChecker( | 94 void CastBrowserProcess::SetConnectivityChecker( |
102 scoped_refptr<ConnectivityChecker> connectivity_checker) { | 95 scoped_refptr<ConnectivityChecker> connectivity_checker) { |
103 DCHECK(!connectivity_checker_); | 96 DCHECK(!connectivity_checker_); |
104 connectivity_checker_.swap(connectivity_checker); | 97 connectivity_checker_.swap(connectivity_checker); |
105 } | 98 } |
106 | 99 |
107 } // namespace shell | 100 } // namespace shell |
108 } // namespace chromecast | 101 } // namespace chromecast |
OLD | NEW |