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 CastContentBrowserClient
;
35 class CastResourceDispatcherHostDelegate
;
36 class RemoteDebuggingServer
;
38 class CastBrowserProcess
{
40 // Gets the global instance of CastBrowserProcess. Does not create lazily and
41 // assumes the instance already exists.
42 static CastBrowserProcess
* GetInstance();
45 virtual ~CastBrowserProcess();
47 void SetBrowserContext(scoped_ptr
<CastBrowserContext
> browser_context
);
48 void SetCastContentBrowserClient(CastContentBrowserClient
* browser_client
);
49 void SetCastService(scoped_ptr
<CastService
> cast_service
);
51 void SetCastScreen(scoped_ptr
<CastScreen
> cast_screen
);
52 #endif // defined(USE_AURA)
53 void SetMetricsHelper(scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper
);
54 void SetMetricsServiceClient(
55 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client
);
56 void SetPrefService(scoped_ptr
<PrefService
> pref_service
);
57 void SetRemoteDebuggingServer(
58 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server
);
59 void SetResourceDispatcherHostDelegate(
60 scoped_ptr
<CastResourceDispatcherHostDelegate
> delegate
);
61 #if defined(OS_ANDROID)
62 void SetCrashDumpManager(
63 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager
);
64 #endif // defined(OS_ANDROID)
65 void SetConnectivityChecker(
66 scoped_refptr
<ConnectivityChecker
> connectivity_checker
);
67 void SetNetLog(net::NetLog
* net_log
);
69 CastContentBrowserClient
* browser_client() const {
70 return cast_content_browser_client_
;
72 CastBrowserContext
* browser_context() const { return browser_context_
.get(); }
73 CastService
* cast_service() const { return cast_service_
.get(); }
75 CastScreen
* cast_screen() const { return cast_screen_
.get(); }
76 #endif // defined(USE_AURA)
77 metrics::CastMetricsServiceClient
* metrics_service_client() const {
78 return metrics_service_client_
.get();
80 PrefService
* pref_service() const { return pref_service_
.get(); }
81 CastResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate()
83 return resource_dispatcher_host_delegate_
.get();
85 ConnectivityChecker
* connectivity_checker() const {
86 return connectivity_checker_
.get();
88 net::NetLog
* net_log() const { return net_log_
; }
91 // Note: The following order should match the order they are set in
92 // CastBrowserMainParts.
93 scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper_
;
95 scoped_ptr
<CastScreen
> cast_screen_
;
96 #endif // defined(USE_AURA)
97 scoped_ptr
<PrefService
> pref_service_
;
98 scoped_refptr
<ConnectivityChecker
> connectivity_checker_
;
99 scoped_ptr
<CastBrowserContext
> browser_context_
;
100 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client_
;
101 scoped_ptr
<CastResourceDispatcherHostDelegate
>
102 resource_dispatcher_host_delegate_
;
103 #if defined(OS_ANDROID)
104 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager_
;
105 #endif // defined(OS_ANDROID)
106 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server_
;
108 CastContentBrowserClient
* cast_content_browser_client_
;
109 net::NetLog
* net_log_
;
111 // Note: CastService must be destroyed before others.
112 scoped_ptr
<CastService
> cast_service_
;
114 DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess
);
118 } // namespace chromecast
120 #endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_