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
18 namespace chromecast
{
20 class ConnectivityChecker
;
23 class CastMetricsHelper
;
24 class CastMetricsServiceClient
;
25 } // namespace metrics
28 class CastBrowserContext
;
29 class CastResourceDispatcherHostDelegate
;
30 class RemoteDebuggingServer
;
32 class CastBrowserProcess
{
34 // Gets the global instance of CastBrowserProcess. Does not create lazily and
35 // assumes the instance already exists.
36 static CastBrowserProcess
* GetInstance();
39 virtual ~CastBrowserProcess();
41 void SetBrowserContext(scoped_ptr
<CastBrowserContext
> browser_context
);
42 void SetCastService(scoped_ptr
<CastService
> cast_service
);
43 void SetMetricsHelper(scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper
);
44 void SetMetricsServiceClient(
45 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client
);
46 void SetPrefService(scoped_ptr
<PrefService
> pref_service
);
47 void SetRemoteDebuggingServer(
48 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server
);
49 void SetResourceDispatcherHostDelegate(
50 scoped_ptr
<CastResourceDispatcherHostDelegate
> delegate
);
51 #if defined(OS_ANDROID)
52 void SetCrashDumpManager(
53 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager
);
54 #endif // defined(OS_ANDROID)
55 void SetConnectivityChecker(
56 scoped_refptr
<ConnectivityChecker
> connectivity_checker
);
58 CastBrowserContext
* browser_context() const { return browser_context_
.get(); }
59 CastService
* cast_service() const { return cast_service_
.get(); }
60 metrics::CastMetricsServiceClient
* metrics_service_client() const {
61 return metrics_service_client_
.get();
63 PrefService
* pref_service() const { return pref_service_
.get(); }
64 CastResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate()
66 return resource_dispatcher_host_delegate_
.get();
68 ConnectivityChecker
* connectivity_checker() const {
69 return connectivity_checker_
.get();
73 // Note: The following order should match the order they are set in
74 // CastBrowserMainParts.
75 scoped_ptr
<metrics::CastMetricsHelper
> metrics_helper_
;
76 scoped_ptr
<PrefService
> pref_service_
;
77 scoped_refptr
<ConnectivityChecker
> connectivity_checker_
;
78 scoped_ptr
<CastBrowserContext
> browser_context_
;
79 scoped_ptr
<metrics::CastMetricsServiceClient
> metrics_service_client_
;
80 scoped_ptr
<CastResourceDispatcherHostDelegate
>
81 resource_dispatcher_host_delegate_
;
82 #if defined(OS_ANDROID)
83 scoped_ptr
<breakpad::CrashDumpManager
> crash_dump_manager_
;
84 #endif // defined(OS_ANDROID)
85 scoped_ptr
<RemoteDebuggingServer
> remote_debugging_server_
;
87 // Note: CastService must be destroyed before others.
88 scoped_ptr
<CastService
> cast_service_
;
90 DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess
);
94 } // namespace chromecast
96 #endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_