Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: chrome/browser/service_process/service_process_control.h

Issue 2925973002: Migrate upgrade notifications to observer (Closed)
Patch Set: Add DISALLOW_COPY_AND_ASSIGN Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <queue> 11 #include <queue>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/cancelable_callback.h" 17 #include "base/cancelable_callback.h"
18 #include "base/id_map.h" 18 #include "base/id_map.h"
19 #include "base/memory/singleton.h" 19 #include "base/memory/singleton.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/process/process.h" 21 #include "base/process/process.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "chrome/browser/upgrade_observer.h"
24 #include "content/public/browser/notification_registrar.h"
25 #include "ipc/ipc_channel_proxy.h" 24 #include "ipc/ipc_channel_proxy.h"
26 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
27 #include "ipc/ipc_sender.h" 26 #include "ipc/ipc_sender.h"
28 27
29 namespace base { 28 namespace base {
30 class CommandLine; 29 class CommandLine;
31 } 30 }
32 31
33 namespace cloud_print { 32 namespace cloud_print {
34 struct CloudPrintProxyInfo; 33 struct CloudPrintProxyInfo;
(...skipping 10 matching lines...) Expand all
45 // 44 //
46 // It is used to start and terminate the service process. It is also used 45 // It is used to start and terminate the service process. It is also used
47 // to send and receive IPC messages from the service process. 46 // to send and receive IPC messages from the service process.
48 // 47 //
49 // THREADING 48 // THREADING
50 // 49 //
51 // This class is accessed on the UI thread through some UI actions. It then 50 // This class is accessed on the UI thread through some UI actions. It then
52 // talks to the IPC channel on the IO thread. 51 // talks to the IPC channel on the IO thread.
53 class ServiceProcessControl : public IPC::Sender, 52 class ServiceProcessControl : public IPC::Sender,
54 public IPC::Listener, 53 public IPC::Listener,
55 public content::NotificationObserver { 54 public UpgradeObserver {
56 public: 55 public:
57 enum ServiceProcessEvent { 56 enum ServiceProcessEvent {
58 SERVICE_EVENT_INITIALIZE, 57 SERVICE_EVENT_INITIALIZE,
59 SERVICE_EVENT_ENABLED_ON_LAUNCH, 58 SERVICE_EVENT_ENABLED_ON_LAUNCH,
60 SERVICE_EVENT_ENABLE, 59 SERVICE_EVENT_ENABLE,
61 SERVICE_EVENT_DISABLE, 60 SERVICE_EVENT_DISABLE,
62 SERVICE_EVENT_DISABLE_BY_POLICY, 61 SERVICE_EVENT_DISABLE_BY_POLICY,
63 SERVICE_EVENT_LAUNCH, 62 SERVICE_EVENT_LAUNCH,
64 SERVICE_EVENT_LAUNCHED, 63 SERVICE_EVENT_LAUNCHED,
65 SERVICE_EVENT_LAUNCH_FAILED, 64 SERVICE_EVENT_LAUNCH_FAILED,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 virtual void Disconnect(); 106 virtual void Disconnect();
108 107
109 // IPC::Listener implementation. 108 // IPC::Listener implementation.
110 bool OnMessageReceived(const IPC::Message& message) override; 109 bool OnMessageReceived(const IPC::Message& message) override;
111 void OnChannelConnected(int32_t peer_pid) override; 110 void OnChannelConnected(int32_t peer_pid) override;
112 void OnChannelError() override; 111 void OnChannelError() override;
113 112
114 // IPC::Sender implementation 113 // IPC::Sender implementation
115 bool Send(IPC::Message* message) override; 114 bool Send(IPC::Message* message) override;
116 115
117 // content::NotificationObserver implementation. 116 // UpgradeObserver implementation.
118 void Observe(int type, 117 void OnUpgradeRecommended() override;
119 const content::NotificationSource& source,
120 const content::NotificationDetails& details) override;
121 118
122 // Send a shutdown message to the service process. IPC channel will be 119 // Send a shutdown message to the service process. IPC channel will be
123 // destroyed after calling this method. 120 // destroyed after calling this method.
124 // Return true if the message was sent. 121 // Return true if the message was sent.
125 // Virtual for testing. 122 // Virtual for testing.
126 virtual bool Shutdown(); 123 virtual bool Shutdown();
127 124
128 // Send request for cloud print proxy info (enabled state, email, proxy id). 125 // Send request for cloud print proxy info (enabled state, email, proxy id).
129 // The callback gets the information when received. 126 // The callback gets the information when received.
130 // Returns true if request was sent. Callback will be called only in case of 127 // Returns true if request was sent. Callback will be called only in case of
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 PrintersCallback printers_callback_; 231 PrintersCallback printers_callback_;
235 232
236 // Callback that gets invoked when a status message is received from 233 // Callback that gets invoked when a status message is received from
237 // the cloud print proxy. 234 // the cloud print proxy.
238 CloudPrintProxyInfoCallback cloud_print_info_callback_; 235 CloudPrintProxyInfoCallback cloud_print_info_callback_;
239 236
240 // Callback that gets invoked when a message with histograms is received from 237 // Callback that gets invoked when a message with histograms is received from
241 // the service process. 238 // the service process.
242 base::Closure histograms_callback_; 239 base::Closure histograms_callback_;
243 240
244 content::NotificationRegistrar registrar_;
245
246 // Callback that gets invoked if service didn't reply in time. 241 // Callback that gets invoked if service didn't reply in time.
247 base::CancelableClosure histograms_timeout_callback_; 242 base::CancelableClosure histograms_timeout_callback_;
248 243
244 // If true changes to UpgradeObserver are applied, if false they are ignored.
245 bool apply_changes_from_upgrade_observer_;
246
249 base::WeakPtrFactory<ServiceProcessControl> weak_factory_; 247 base::WeakPtrFactory<ServiceProcessControl> weak_factory_;
248
249 DISALLOW_COPY_AND_ASSIGN(ServiceProcessControl);
250 }; 250 };
251 251
252 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ 252 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/service_process/service_process_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698