| 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_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 5 #ifndef CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| 6 #define CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 6 #define CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // |success_task| can be invoked in the context of the Launch call. | 91 // |success_task| can be invoked in the context of the Launch call. |
| 92 // Virtual for testing. | 92 // Virtual for testing. |
| 93 virtual void Launch(const base::Closure& success_task, | 93 virtual void Launch(const base::Closure& success_task, |
| 94 const base::Closure& failure_task); | 94 const base::Closure& failure_task); |
| 95 | 95 |
| 96 // Disconnect the IPC channel from the service process. | 96 // Disconnect the IPC channel from the service process. |
| 97 // Virtual for testing. | 97 // Virtual for testing. |
| 98 virtual void Disconnect(); | 98 virtual void Disconnect(); |
| 99 | 99 |
| 100 // IPC::Listener implementation. | 100 // IPC::Listener implementation. |
| 101 virtual bool OnMessageReceived(const IPC::Message& message) override; | 101 bool OnMessageReceived(const IPC::Message& message) override; |
| 102 virtual void OnChannelConnected(int32 peer_pid) override; | 102 void OnChannelConnected(int32 peer_pid) override; |
| 103 virtual void OnChannelError() override; | 103 void OnChannelError() override; |
| 104 | 104 |
| 105 // IPC::Sender implementation | 105 // IPC::Sender implementation |
| 106 virtual bool Send(IPC::Message* message) override; | 106 bool Send(IPC::Message* message) override; |
| 107 | 107 |
| 108 // content::NotificationObserver implementation. | 108 // content::NotificationObserver implementation. |
| 109 virtual void Observe(int type, | 109 void Observe(int type, |
| 110 const content::NotificationSource& source, | 110 const content::NotificationSource& source, |
| 111 const content::NotificationDetails& details) override; | 111 const content::NotificationDetails& details) override; |
| 112 | 112 |
| 113 // Send a shutdown message to the service process. IPC channel will be | 113 // Send a shutdown message to the service process. IPC channel will be |
| 114 // destroyed after calling this method. | 114 // destroyed after calling this method. |
| 115 // Return true if the message was sent. | 115 // Return true if the message was sent. |
| 116 // Virtual for testing. | 116 // Virtual for testing. |
| 117 virtual bool Shutdown(); | 117 virtual bool Shutdown(); |
| 118 | 118 |
| 119 // Send request for cloud print proxy info (enabled state, email, proxy id). | 119 // Send request for cloud print proxy info (enabled state, email, proxy id). |
| 120 // The callback gets the information when received. | 120 // The callback gets the information when received. |
| 121 // Returns true if request was sent. Callback will be called only in case of | 121 // Returns true if request was sent. Callback will be called only in case of |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 base::Closure notify_task_; | 170 base::Closure notify_task_; |
| 171 bool launched_; | 171 bool launched_; |
| 172 uint32 retry_count_; | 172 uint32 retry_count_; |
| 173 base::ProcessHandle process_handle_; | 173 base::ProcessHandle process_handle_; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 friend class MockServiceProcessControl; | 176 friend class MockServiceProcessControl; |
| 177 friend class CloudPrintProxyPolicyStartupTest; | 177 friend class CloudPrintProxyPolicyStartupTest; |
| 178 | 178 |
| 179 ServiceProcessControl(); | 179 ServiceProcessControl(); |
| 180 virtual ~ServiceProcessControl(); | 180 ~ServiceProcessControl() override; |
| 181 | 181 |
| 182 friend struct DefaultSingletonTraits<ServiceProcessControl>; | 182 friend struct DefaultSingletonTraits<ServiceProcessControl>; |
| 183 | 183 |
| 184 typedef std::vector<base::Closure> TaskList; | 184 typedef std::vector<base::Closure> TaskList; |
| 185 | 185 |
| 186 // Message handlers | 186 // Message handlers |
| 187 void OnCloudPrintProxyInfo( | 187 void OnCloudPrintProxyInfo( |
| 188 const cloud_print::CloudPrintProxyInfo& proxy_info); | 188 const cloud_print::CloudPrintProxyInfo& proxy_info); |
| 189 void OnHistograms(const std::vector<std::string>& pickled_histograms); | 189 void OnHistograms(const std::vector<std::string>& pickled_histograms); |
| 190 void OnPrinters(const std::vector<std::string>& printers); | 190 void OnPrinters(const std::vector<std::string>& printers); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // the service process. | 229 // the service process. |
| 230 base::Closure histograms_callback_; | 230 base::Closure histograms_callback_; |
| 231 | 231 |
| 232 content::NotificationRegistrar registrar_; | 232 content::NotificationRegistrar registrar_; |
| 233 | 233 |
| 234 // Callback that gets invoked if service didn't reply in time. | 234 // Callback that gets invoked if service didn't reply in time. |
| 235 base::CancelableClosure histograms_timeout_callback_; | 235 base::CancelableClosure histograms_timeout_callback_; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 238 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| OLD | NEW |