OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_SERVICE_SERVICE_PROCESS_H_ | 5 #ifndef CHROME_SERVICE_SERVICE_PROCESS_H_ |
6 #define CHROME_SERVICE_SERVICE_PROCESS_H_ | 6 #define CHROME_SERVICE_SERVICE_PROCESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace net { | 24 namespace net { |
25 class NetworkChangeNotifier; | 25 class NetworkChangeNotifier; |
26 } | 26 } |
27 | 27 |
28 class CommandLine; | 28 class CommandLine; |
29 | 29 |
30 // The ServiceProcess does not inherit from ChildProcess because this | 30 // The ServiceProcess does not inherit from ChildProcess because this |
31 // process can live independently of the browser process. | 31 // process can live independently of the browser process. |
32 // ServiceProcess Design Notes | 32 // ServiceProcess Design Notes |
33 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/servi
ce-processes | 33 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/servi
ce-processes |
34 class ServiceProcess : public CloudPrintProxy::Client { | 34 class ServiceProcess : public cloud_print::CloudPrintProxy::Client { |
35 public: | 35 public: |
36 ServiceProcess(); | 36 ServiceProcess(); |
37 virtual ~ServiceProcess(); | 37 virtual ~ServiceProcess(); |
38 | 38 |
39 // Initialize the ServiceProcess with the message loop that it should run on. | 39 // Initialize the ServiceProcess with the message loop that it should run on. |
40 // ServiceProcess takes ownership of |state|. | 40 // ServiceProcess takes ownership of |state|. |
41 bool Initialize(MessageLoopForUI* message_loop, | 41 bool Initialize(MessageLoopForUI* message_loop, |
42 const CommandLine& command_line, | 42 const CommandLine& command_line, |
43 ServiceProcessState* state); | 43 ServiceProcessState* state); |
44 | 44 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void SetUpdateAvailable() { | 79 void SetUpdateAvailable() { |
80 update_available_ = true; | 80 update_available_ = true; |
81 } | 81 } |
82 bool update_available() const { return update_available_; } | 82 bool update_available() const { return update_available_; } |
83 | 83 |
84 // Called by the IPC server when a client disconnects. A return value of | 84 // Called by the IPC server when a client disconnects. A return value of |
85 // true indicates that the IPC server should continue listening for new | 85 // true indicates that the IPC server should continue listening for new |
86 // connections. | 86 // connections. |
87 bool HandleClientDisconnect(); | 87 bool HandleClientDisconnect(); |
88 | 88 |
89 CloudPrintProxy* GetCloudPrintProxy(); | 89 cloud_print::CloudPrintProxy* GetCloudPrintProxy(); |
90 | 90 |
91 // CloudPrintProxy::Client implementation. | 91 // CloudPrintProxy::Client implementation. |
92 virtual void OnCloudPrintProxyEnabled(bool persist_state) OVERRIDE; | 92 virtual void OnCloudPrintProxyEnabled(bool persist_state) OVERRIDE; |
93 virtual void OnCloudPrintProxyDisabled(bool persist_state) OVERRIDE; | 93 virtual void OnCloudPrintProxyDisabled(bool persist_state) OVERRIDE; |
94 | 94 |
95 ServiceURLRequestContextGetter* GetServiceURLRequestContextGetter(); | 95 ServiceURLRequestContextGetter* GetServiceURLRequestContextGetter(); |
96 | 96 |
97 private: | 97 private: |
98 friend class TestServiceProcess; | 98 friend class TestServiceProcess; |
99 | 99 |
(...skipping 18 matching lines...) Expand all Loading... |
118 // disabled in this process (note that shutdown != disabled). | 118 // disabled in this process (note that shutdown != disabled). |
119 void OnServiceDisabled(); | 119 void OnServiceDisabled(); |
120 | 120 |
121 // Terminate forces the service process to quit. | 121 // Terminate forces the service process to quit. |
122 void Terminate(); | 122 void Terminate(); |
123 | 123 |
124 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 124 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
125 scoped_ptr<base::Thread> io_thread_; | 125 scoped_ptr<base::Thread> io_thread_; |
126 scoped_ptr<base::Thread> file_thread_; | 126 scoped_ptr<base::Thread> file_thread_; |
127 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 127 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
128 scoped_ptr<CloudPrintProxy> cloud_print_proxy_; | 128 scoped_ptr<cloud_print::CloudPrintProxy> cloud_print_proxy_; |
129 scoped_ptr<ServiceProcessPrefs> service_prefs_; | 129 scoped_ptr<ServiceProcessPrefs> service_prefs_; |
130 scoped_ptr<ServiceIPCServer> ipc_server_; | 130 scoped_ptr<ServiceIPCServer> ipc_server_; |
131 scoped_ptr<ServiceProcessState> service_process_state_; | 131 scoped_ptr<ServiceProcessState> service_process_state_; |
132 | 132 |
133 // An event that will be signalled when we shutdown. | 133 // An event that will be signalled when we shutdown. |
134 base::WaitableEvent shutdown_event_; | 134 base::WaitableEvent shutdown_event_; |
135 | 135 |
136 // Pointer to the main message loop that host this object. | 136 // Pointer to the main message loop that host this object. |
137 MessageLoop* main_message_loop_; | 137 MessageLoop* main_message_loop_; |
138 | 138 |
139 // Count of currently enabled services in this process. | 139 // Count of currently enabled services in this process. |
140 int enabled_services_; | 140 int enabled_services_; |
141 | 141 |
142 // Speficies whether a product update is available. | 142 // Speficies whether a product update is available. |
143 bool update_available_; | 143 bool update_available_; |
144 | 144 |
145 scoped_refptr<ServiceURLRequestContextGetter> request_context_getter_; | 145 scoped_refptr<ServiceURLRequestContextGetter> request_context_getter_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(ServiceProcess); | 147 DISALLOW_COPY_AND_ASSIGN(ServiceProcess); |
148 }; | 148 }; |
149 | 149 |
150 extern ServiceProcess* g_service_process; | 150 extern ServiceProcess* g_service_process; |
151 | 151 |
152 #endif // CHROME_SERVICE_SERVICE_PROCESS_H_ | 152 #endif // CHROME_SERVICE_SERVICE_PROCESS_H_ |
OLD | NEW |