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 #ifndef CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_
6 #define CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
15 class CrashDumpManager
;
16 } // namespace breakpad
22 namespace chromecast
{
25 class ConnectivityChecker
;
28 class CastMetricsHelper
;
29 class CastMetricsServiceClient
;
30 } // namespace metrics
33 class CastBrowserContext
;
34 class CastResourceDispatcherHostDelegate
;
35 class RemoteDebuggingServer
;
37 class CastBrowserProcess
{
39 // Gets the global instance of CastBrowserProcess. Does not create lazily and
40 // assumes the instance already exists.
41 static CastBrowserProcess
* GetInstance();
44 virtual ~CastBrowserProcess();
46 void SetBrowserContext(scoped_ptr
<CastBrowserContext
> browser_context
);
47 void SetCastService(scoped_ptr
<CastService
> cast_service
);
49 void SetCastScreen(scoped_ptr
<CastScreen
> cast_screen
);
50 #endif // defined(USE_AURA)
51 void SetMetricsHelper(scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper
);
52 void SetMetricsServiceClient(
53 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client
);
54 void SetPrefService(scoped_ptr
<PrefService
> pref_service
);
55 void SetRemoteDebuggingServer(
56 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server
);
57 void SetResourceDispatcherHostDelegate(
58 scoped_ptr
<CastResourceDispatcherHostDelegate
> delegate
);
59 #if defined(OS_ANDROID)
60 void SetCrashDumpManager(
61 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager
);
62 #endif // defined(OS_ANDROID)
63 void SetConnectivityChecker(
64 scoped_refptr
<ConnectivityChecker
> connectivity_checker
);
65 void SetNetLog(net::NetLog
* net_log
);
67 CastBrowserContext
* browser_context() const { return browser_context_
.get(); }
68 CastService
* cast_service() const { return cast_service_
.get(); }
70 CastScreen
* cast_screen() const { return cast_screen_
.get(); }
71 #endif // defined(USE_AURA)
72 metrics::CastMetricsServiceClient
* metrics_service_client() const {
73 return metrics_service_client_
.get();
75 PrefService
* pref_service() const { return pref_service_
.get(); }
76 CastResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate()
78 return resource_dispatcher_host_delegate_
.get();
80 ConnectivityChecker
* connectivity_checker() const {
81 return connectivity_checker_
.get();
83 net::NetLog
* net_log() const { return net_log_
; }
86 // Note: The following order should match the order they are set in
87 // CastBrowserMainParts.
88 scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper_
;
90 scoped_ptr
<CastScreen
> cast_screen_
;
91 #endif // defined(USE_AURA)
92 scoped_ptr
<PrefService
> pref_service_
;
93 scoped_refptr
<ConnectivityChecker
> connectivity_checker_
;
94 scoped_ptr
<CastBrowserContext
> browser_context_
;
95 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client_
;
96 scoped_ptr
<CastResourceDispatcherHostDelegate
>
97 resource_dispatcher_host_delegate_
;
98 #if defined(OS_ANDROID)
99 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager_
;
100 #endif // defined(OS_ANDROID)
101 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server_
;
103 net::NetLog
* net_log_
;
105 // Note: CastService must be destroyed before others.
106 scoped_ptr
<CastService
> cast_service_
;
108 DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess
);
112 } // namespace chromecast
114 #endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_