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.
4
5#include "chromecast/shell/browser/cast_browser_process.h"
6
7#include "base/logging.h"
8#include "chromecast/metrics/cast_metrics_service_client.h"
9#include "chromecast/service/cast_service.h"
10#include "chromecast/shell/browser/cast_browser_context.h"
11#include "chromecast/shell/browser/devtools/remote_debugging_server.h"
12
13namespace chromecast {
14namespace shell {
15
16namespace {
17CastBrowserProcess* g_instance = NULL;
18}  // namespace
19
20// static
21CastBrowserProcess* CastBrowserProcess::GetInstance() {
22  DCHECK(g_instance);
23  return g_instance;
24}
25
26CastBrowserProcess::CastBrowserProcess() {
27  DCHECK(!g_instance);
28  g_instance = this;
29}
30
31CastBrowserProcess::~CastBrowserProcess() {
32  DCHECK_EQ(g_instance, this);
33  g_instance = NULL;
34}
35
36void CastBrowserProcess::SetBrowserContext(
37    CastBrowserContext* browser_context) {
38  DCHECK(!browser_context_);
39  browser_context_.reset(browser_context);
40}
41
42void CastBrowserProcess::SetCastService(CastService* cast_service) {
43  DCHECK(!cast_service_);
44  cast_service_.reset(cast_service);
45}
46
47void CastBrowserProcess::SetRemoteDebuggingServer(
48    RemoteDebuggingServer* remote_debugging_server) {
49  DCHECK(!remote_debugging_server_);
50  remote_debugging_server_.reset(remote_debugging_server);
51}
52
53void CastBrowserProcess::SetMetricsServiceClient(
54    metrics::CastMetricsServiceClient* metrics_service_client) {
55  DCHECK(!metrics_service_client_);
56  metrics_service_client_.reset(metrics_service_client);
57}
58
59}  // namespace shell
60}  // namespace chromecast
61