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

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

Issue 2888763004: Network traffic annotation added to CloudPrintUrlFetcher. (Closed)
Patch Set: nits 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_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/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/service/cloud_print/connector_settings.h" 15 #include "chrome/service/cloud_print/connector_settings.h"
16 #include "chrome/service/cloud_print/print_system.h" 16 #include "chrome/service/cloud_print/print_system.h"
17 #include "chrome/service/cloud_print/printer_job_handler.h" 17 #include "chrome/service/cloud_print/printer_job_handler.h"
18 #include "net/traffic_annotation/network_traffic_annotation.h"
18 19
19 namespace cloud_print { 20 namespace cloud_print {
20 21
21 // CloudPrintConnector handles top printer management tasks. 22 // CloudPrintConnector handles top printer management tasks.
22 // - Matching local and cloud printers 23 // - Matching local and cloud printers
23 // - Registration of local printers 24 // - Registration of local printers
24 // - Deleting cloud printers 25 // - Deleting cloud printers
25 // All tasks are posted to the common queue (PendingTasks) and executed 26 // All tasks are posted to the common queue (PendingTasks) and executed
26 // one-by-one in FIFO order. 27 // one-by-one in FIFO order.
27 // CloudPrintConnector will notify client over Client interface. 28 // CloudPrintConnector will notify client over Client interface.
28 class CloudPrintConnector 29 class CloudPrintConnector
29 : public base::RefCountedThreadSafe<CloudPrintConnector>, 30 : public base::RefCountedThreadSafe<CloudPrintConnector>,
30 private PrintSystem::PrintServerWatcher::Delegate, 31 private PrintSystem::PrintServerWatcher::Delegate,
31 private PrinterJobHandler::Delegate, 32 private PrinterJobHandler::Delegate,
32 private CloudPrintURLFetcher::Delegate { 33 private CloudPrintURLFetcher::Delegate {
33 public: 34 public:
34 class Client { 35 class Client {
35 public: 36 public:
36 virtual void OnAuthFailed() = 0; 37 virtual void OnAuthFailed() = 0;
37 virtual void OnXmppPingUpdated(int ping_timeout) = 0; 38 virtual void OnXmppPingUpdated(int ping_timeout) = 0;
38 protected: 39 protected:
39 virtual ~Client() {} 40 virtual ~Client() {}
40 }; 41 };
41 42
42 CloudPrintConnector(Client* client, const ConnectorSettings& settings); 43 CloudPrintConnector(Client* client,
44 const ConnectorSettings& settings,
45 const net::PartialNetworkTrafficAnnotationTag&
46 partial_traffic_annotation);
43 47
44 bool Start(); 48 bool Start();
45 void Stop(); 49 void Stop();
46 bool IsRunning(); 50 bool IsRunning();
47 51
48 // Return list of printer ids registered with CloudPrint. 52 // Return list of printer ids registered with CloudPrint.
49 std::list<std::string> GetPrinterIds() const; 53 std::list<std::string> GetPrinterIds() const;
50 54
51 // Check for jobs for specific printer. If printer id is empty 55 // Check for jobs for specific printer. If printer id is empty
52 // jobs will be checked for all available printers. 56 // jobs will be checked for all available printers.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 using JobHandlerMap = std::map<std::string, scoped_refptr<PrinterJobHandler>>; 195 using JobHandlerMap = std::map<std::string, scoped_refptr<PrinterJobHandler>>;
192 JobHandlerMap job_handler_map_; 196 JobHandlerMap job_handler_map_;
193 // Next response handler. 197 // Next response handler.
194 ResponseHandler next_response_handler_; 198 ResponseHandler next_response_handler_;
195 // The list of pending tasks to be done in the background. 199 // The list of pending tasks to be done in the background.
196 std::list<PendingTask> pending_tasks_; 200 std::list<PendingTask> pending_tasks_;
197 // The CloudPrintURLFetcher instance for the current request. 201 // The CloudPrintURLFetcher instance for the current request.
198 scoped_refptr<CloudPrintURLFetcher> request_; 202 scoped_refptr<CloudPrintURLFetcher> request_;
199 // The CloudPrintURLFetcher instance for the user message request. 203 // The CloudPrintURLFetcher instance for the user message request.
200 scoped_refptr<CloudPrintURLFetcher> user_message_request_; 204 scoped_refptr<CloudPrintURLFetcher> user_message_request_;
205 // Partial network traffic annotation for network requests.
206 const net::PartialNetworkTrafficAnnotationTag partial_traffic_annotation_;
207
201 base::WeakPtrFactory<CloudPrintConnector> stats_ptr_factory_; 208 base::WeakPtrFactory<CloudPrintConnector> stats_ptr_factory_;
202 209
203 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); 210 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector);
204 }; 211 };
205 212
206 } // namespace cloud_print 213 } // namespace cloud_print
207 214
208 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ 215 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_
209 216
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_auth.cc ('k') | chrome/service/cloud_print/cloud_print_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698