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

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

Issue 8403015: base::Bind: Convert ServiceProcessControl::CloudPrintProxyInfoHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_SERVICE_PROCESS_CONTROL_H_ 5 #ifndef CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_
6 #define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ 6 #define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/callback_old.h"
16 #include "base/id_map.h" 15 #include "base/id_map.h"
17 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
19 #include "base/process.h" 18 #include "base/process.h"
20 #include "base/task.h" 19 #include "base/task.h"
21 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
23 #include "ipc/ipc_channel_proxy.h" 22 #include "ipc/ipc_channel_proxy.h"
24 23
25 class CommandLine; 24 class CommandLine;
(...skipping 11 matching lines...) Expand all
37 // THREADING 36 // THREADING
38 // 37 //
39 // This class is accessed on the UI thread through some UI actions. It then 38 // This class is accessed on the UI thread through some UI actions. It then
40 // talks to the IPC channel on the IO thread. 39 // talks to the IPC channel on the IO thread.
41 class ServiceProcessControl : public IPC::Channel::Sender, 40 class ServiceProcessControl : public IPC::Channel::Sender,
42 public IPC::Channel::Listener, 41 public IPC::Channel::Listener,
43 public content::NotificationObserver { 42 public content::NotificationObserver {
44 public: 43 public:
45 typedef IDMap<ServiceProcessControl>::iterator iterator; 44 typedef IDMap<ServiceProcessControl>::iterator iterator;
46 typedef std::queue<IPC::Message> MessageQueue; 45 typedef std::queue<IPC::Message> MessageQueue;
47 typedef Callback1<const cloud_print::CloudPrintProxyInfo&>::Type 46 typedef base::Callback<void(const cloud_print::CloudPrintProxyInfo&)>
48 CloudPrintProxyInfoHandler; 47 CloudPrintProxyInfoHandler;
49 48
50 // Returns the singleton instance of this class. 49 // Returns the singleton instance of this class.
51 static ServiceProcessControl* GetInstance(); 50 static ServiceProcessControl* GetInstance();
52 // Return true if this object is connected to the service. 51 // Return true if this object is connected to the service.
53 bool is_connected() const { return channel_.get() != NULL; } 52 bool is_connected() const { return channel_.get() != NULL; }
54 53
55 // If no service process is currently running, creates a new service process 54 // If no service process is currently running, creates a new service process
56 // and connects to it. If a service process is already running this method 55 // and connects to it. If a service process is already running this method
57 // will try to connect to it. 56 // will try to connect to it.
(...skipping 28 matching lines...) Expand all
86 const cloud_print::CloudPrintProxyInfo& proxy_info); 85 const cloud_print::CloudPrintProxyInfo& proxy_info);
87 86
88 // Send a shutdown message to the service process. IPC channel will be 87 // Send a shutdown message to the service process. IPC channel will be
89 // destroyed after calling this method. 88 // destroyed after calling this method.
90 // Return true if the message was sent. 89 // Return true if the message was sent.
91 bool Shutdown(); 90 bool Shutdown();
92 91
93 // Send request for cloud print proxy info (enabled state, email, proxy id). 92 // Send request for cloud print proxy info (enabled state, email, proxy id).
94 // The callback gets the information when received. 93 // The callback gets the information when received.
95 bool GetCloudPrintProxyInfo( 94 bool GetCloudPrintProxyInfo(
96 CloudPrintProxyInfoHandler* cloud_print_status_callback); 95 const CloudPrintProxyInfoHandler& cloud_print_status_callback);
97 96
98 private: 97 private:
99 // This class is responsible for launching the service process on the 98 // This class is responsible for launching the service process on the
100 // PROCESS_LAUNCHER thread. 99 // PROCESS_LAUNCHER thread.
101 class Launcher 100 class Launcher
102 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> { 101 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> {
103 public: 102 public:
104 Launcher(ServiceProcessControl* process, CommandLine* cmd_line); 103 Launcher(ServiceProcessControl* process, CommandLine* cmd_line);
105 // Execute the command line to start the process asynchronously. 104 // Execute the command line to start the process asynchronously.
106 // After the comamnd is executed |task| is called with the process handle on 105 // After the comamnd is executed |task| is called with the process handle on
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Service process launcher. 149 // Service process launcher.
151 scoped_refptr<Launcher> launcher_; 150 scoped_refptr<Launcher> launcher_;
152 151
153 // Callbacks that get invoked when the channel is successfully connected. 152 // Callbacks that get invoked when the channel is successfully connected.
154 TaskList connect_success_tasks_; 153 TaskList connect_success_tasks_;
155 // Callbacks that get invoked when there was a connection failure. 154 // Callbacks that get invoked when there was a connection failure.
156 TaskList connect_failure_tasks_; 155 TaskList connect_failure_tasks_;
157 156
158 // Callback that gets invoked when a status message is received from 157 // Callback that gets invoked when a status message is received from
159 // the cloud print proxy. 158 // the cloud print proxy.
160 scoped_ptr<CloudPrintProxyInfoHandler> cloud_print_info_callback_; 159 CloudPrintProxyInfoHandler cloud_print_info_callback_;
161 160
162 content::NotificationRegistrar registrar_; 161 content::NotificationRegistrar registrar_;
163 }; 162 };
164 163
165 #endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ 164 #endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_
OLDNEW
« no previous file with comments | « chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc ('k') | chrome/browser/service/service_process_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698