Disable flaky testHTTPResponseTimelineRecorder on Mac
[chromium-blink-merge.git] / chromecast / browser / cast_browser_process.cc
blob8712775e231cdb2c476e11490867335cf0195238
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
3 // found in the LICENSE file.
5 #include "chromecast/browser/cast_browser_process.h"
7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h"
9 #include "chromecast/base/metrics/cast_metrics_helper.h"
10 #include "chromecast/browser/cast_browser_context.h"
11 #include "chromecast/browser/devtools/remote_debugging_server.h"
12 #include "chromecast/browser/metrics/cast_metrics_service_client.h"
13 #include "chromecast/browser/service/cast_service.h"
15 #if defined(OS_ANDROID)
16 #include "components/crash/browser/crash_dump_manager_android.h"
17 #endif // defined(OS_ANDROID)
19 #if defined(USE_AURA)
20 #include "ui/aura/env.h"
21 #endif
23 namespace chromecast {
24 namespace shell {
26 namespace {
27 CastBrowserProcess* g_instance = NULL;
28 } // namespace
30 // static
31 CastBrowserProcess* CastBrowserProcess::GetInstance() {
32 DCHECK(g_instance);
33 return g_instance;
36 CastBrowserProcess::CastBrowserProcess() {
37 DCHECK(!g_instance);
38 g_instance = this;
41 CastBrowserProcess::~CastBrowserProcess() {
42 DCHECK_EQ(g_instance, this);
43 if (pref_service_)
44 pref_service_->CommitPendingWrite();
45 #if defined(USE_AURA)
46 aura::Env::DeleteInstance();
47 #endif
48 g_instance = NULL;
51 void CastBrowserProcess::SetBrowserContext(
52 scoped_ptr<CastBrowserContext> browser_context) {
53 DCHECK(!browser_context_);
54 browser_context_.swap(browser_context);
57 void CastBrowserProcess::SetCastService(scoped_ptr<CastService> cast_service) {
58 DCHECK(!cast_service_);
59 cast_service_.swap(cast_service);
62 void CastBrowserProcess::SetMetricsHelper(
63 scoped_ptr<metrics::CastMetricsHelper> metrics_helper) {
64 DCHECK(!metrics_helper_);
65 metrics_helper_.swap(metrics_helper);
68 void CastBrowserProcess::SetMetricsServiceClient(
69 scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client) {
70 DCHECK(!metrics_service_client_);
71 metrics_service_client_.swap(metrics_service_client);
74 void CastBrowserProcess::SetPrefService(scoped_ptr<PrefService> pref_service) {
75 DCHECK(!pref_service_);
76 pref_service_.swap(pref_service);
79 void CastBrowserProcess::SetRemoteDebuggingServer(
80 scoped_ptr<RemoteDebuggingServer> remote_debugging_server) {
81 DCHECK(!remote_debugging_server_);
82 remote_debugging_server_.swap(remote_debugging_server);
85 #if defined(OS_ANDROID)
86 void CastBrowserProcess::SetCrashDumpManager(
87 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager) {
88 DCHECK(!crash_dump_manager_);
89 crash_dump_manager_.swap(crash_dump_manager);
91 #endif // defined(OS_ANDROID)
93 } // namespace shell
94 } // namespace chromecast