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

Side by Side Diff: chrome/service/cloud_print/cloud_print_connector.h

Issue 10968031: Added ConnectorSettings class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/service/cloud_print/cloud_print_connector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/service/cloud_print/connector_settings.h"
14 #include "chrome/service/cloud_print/print_system.h" 15 #include "chrome/service/cloud_print/print_system.h"
15 #include "chrome/service/cloud_print/printer_job_handler.h" 16 #include "chrome/service/cloud_print/printer_job_handler.h"
16 17
17 // CloudPrintConnector handles top printer management tasks. 18 // CloudPrintConnector handles top printer management tasks.
18 // - Matching local and cloud printers 19 // - Matching local and cloud printers
19 // - Registration of local printers 20 // - Registration of local printers
20 // - Deleting cloud printers 21 // - Deleting cloud printers
21 // All tasks are posted to the commond queue (PendingTasks) and executed 22 // All tasks are posted to the common queue (PendingTasks) and executed
22 // one-by-one in FIFO order. 23 // one-by-one in FIFO order.
23 // CloudPrintConnector will notify client over Client interface. 24 // CloudPrintConnector will notify client over Client interface.
24 class CloudPrintConnector 25 class CloudPrintConnector
25 : public base::RefCountedThreadSafe<CloudPrintConnector>, 26 : public base::RefCountedThreadSafe<CloudPrintConnector>,
26 public cloud_print::PrintServerWatcherDelegate, 27 public cloud_print::PrintServerWatcherDelegate,
27 public PrinterJobHandlerDelegate, 28 public PrinterJobHandlerDelegate,
28 public CloudPrintURLFetcherDelegate { 29 public CloudPrintURLFetcherDelegate {
29 public: 30 public:
30 class Client { 31 class Client {
31 public: 32 public:
32 virtual void OnAuthFailed() = 0; 33 virtual void OnAuthFailed() = 0;
33 protected: 34 protected:
34 virtual ~Client() {} 35 virtual ~Client() {}
35 }; 36 };
36 37
37 CloudPrintConnector(Client* client, 38 CloudPrintConnector(Client* client, const ConnectorSettings& settings);
38 const std::string& proxy_id,
39 const GURL& cloud_print_server_url,
40 const DictionaryValue* print_system_settings);
41 39
42 bool Start(); 40 bool Start();
43 void Stop(); 41 void Stop();
44 bool IsRunning(); 42 bool IsRunning();
45 43
46 // Return list of printer ids registered with CloudPrint. 44 // Return list of printer ids registered with CloudPrint.
47 void GetPrinterIds(std::list<std::string>* printer_ids); 45 void GetPrinterIds(std::list<std::string>* printer_ids);
48 46
49 // Register printer from the list. 47 // Register printer from the list.
50 void RegisterPrinters(const printing::PrinterList& printers); 48 void RegisterPrinters(const printing::PrinterList& printers);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void OnReceivePrinterCaps( 153 void OnReceivePrinterCaps(
156 bool succeeded, 154 bool succeeded,
157 const std::string& printer_name, 155 const std::string& printer_name,
158 const printing::PrinterCapsAndDefaults& caps_and_defaults); 156 const printing::PrinterCapsAndDefaults& caps_and_defaults);
159 157
160 bool IsSamePrinter(const std::string& name1, const std::string& name2) const; 158 bool IsSamePrinter(const std::string& name1, const std::string& name2) const;
161 bool InitPrintSystem(); 159 bool InitPrintSystem();
162 160
163 // CloudPrintConnector client. 161 // CloudPrintConnector client.
164 Client* client_; 162 Client* client_;
165 // Print system settings. 163 // Connector settings.
166 scoped_ptr<DictionaryValue> print_system_settings_; 164 ConnectorSettings settings_;
167 // Pointer to current print system. 165 // Pointer to current print system.
168 scoped_refptr<cloud_print::PrintSystem> print_system_; 166 scoped_refptr<cloud_print::PrintSystem> print_system_;
169 // Watcher for print system updates. 167 // Watcher for print system updates.
170 scoped_refptr<cloud_print::PrintSystem::PrintServerWatcher> 168 scoped_refptr<cloud_print::PrintSystem::PrintServerWatcher>
171 print_server_watcher_; 169 print_server_watcher_;
172 // Id of the Cloud Print proxy.
173 std::string proxy_id_;
174 // Cloud Print server url.
175 GURL cloud_print_server_url_;
176 // A map of printer id to job handler. 170 // A map of printer id to job handler.
177 typedef std::map<std::string, scoped_refptr<PrinterJobHandler> > 171 typedef std::map<std::string, scoped_refptr<PrinterJobHandler> >
178 JobHandlerMap; 172 JobHandlerMap;
179 JobHandlerMap job_handler_map_; 173 JobHandlerMap job_handler_map_;
180 // Next response handler. 174 // Next response handler.
181 ResponseHandler next_response_handler_; 175 ResponseHandler next_response_handler_;
182 // If |true| printers that are not found locally will be deleted on GCP
183 // even if the local enumeration failed.
184 bool delete_on_enum_fail_;
185 // The list of pending tasks to be done in the background. 176 // The list of pending tasks to be done in the background.
186 std::list<PendingTask> pending_tasks_; 177 std::list<PendingTask> pending_tasks_;
187 // The CloudPrintURLFetcher instance for the current request. 178 // The CloudPrintURLFetcher instance for the current request.
188 scoped_refptr<CloudPrintURLFetcher> request_; 179 scoped_refptr<CloudPrintURLFetcher> request_;
189 // The CloudPrintURLFetcher instance for the user message request. 180 // The CloudPrintURLFetcher instance for the user message request.
190 scoped_refptr<CloudPrintURLFetcher> user_message_request_; 181 scoped_refptr<CloudPrintURLFetcher> user_message_request_;
191 182
192 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); 183 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector);
193 }; 184 };
194 185
195 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ 186 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_
196 187
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/service/cloud_print/cloud_print_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698