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_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" | 12 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" |
| 13 #include "net/traffic_annotation/network_traffic_annotation.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace cloud_print { | 16 namespace cloud_print { |
16 | 17 |
17 // CloudPrintWipeout unregisters list of printers from the cloudprint service. | 18 // CloudPrintWipeout unregisters list of printers from the cloudprint service. |
18 class CloudPrintWipeout : public CloudPrintURLFetcher::Delegate { | 19 class CloudPrintWipeout : public CloudPrintURLFetcher::Delegate { |
19 public: | 20 public: |
20 class Client { | 21 class Client { |
21 public: | 22 public: |
22 virtual void OnUnregisterPrintersComplete() = 0; | 23 virtual void OnUnregisterPrintersComplete() = 0; |
23 protected: | 24 protected: |
24 virtual ~Client() {} | 25 virtual ~Client() {} |
25 }; | 26 }; |
26 | 27 |
27 CloudPrintWipeout(Client* client, const GURL& cloud_print_server_url); | 28 CloudPrintWipeout(Client* client, |
| 29 const GURL& cloud_print_server_url, |
| 30 const net::PartialNetworkTrafficAnnotationTag& |
| 31 partial_traffic_annotation); |
28 ~CloudPrintWipeout() override; | 32 ~CloudPrintWipeout() override; |
29 | 33 |
30 void UnregisterPrinters(const std::string& auth_token, | 34 void UnregisterPrinters(const std::string& auth_token, |
31 const std::list<std::string>& printer_ids); | 35 const std::list<std::string>& printer_ids); |
32 | 36 |
33 // CloudPrintURLFetcher::Delegate implementation. | 37 // CloudPrintURLFetcher::Delegate implementation. |
34 CloudPrintURLFetcher::ResponseAction HandleJSONData( | 38 CloudPrintURLFetcher::ResponseAction HandleJSONData( |
35 const net::URLFetcher* source, | 39 const net::URLFetcher* source, |
36 const GURL& url, | 40 const GURL& url, |
37 const base::DictionaryValue* json_data, | 41 const base::DictionaryValue* json_data, |
38 bool succeeded) override; | 42 bool succeeded) override; |
39 void OnRequestGiveUp() override; | 43 void OnRequestGiveUp() override; |
40 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; | 44 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; |
41 std::string GetAuthHeader() override; | 45 std::string GetAuthHeader() override; |
42 | 46 |
43 private: | 47 private: |
44 void UnregisterNextPrinter(); | 48 void UnregisterNextPrinter(); |
45 | 49 |
46 // CloudPrintWipeout client. | 50 // CloudPrintWipeout client. |
47 Client* client_; | 51 Client* client_; |
48 // Cloud Print server url. | 52 // Cloud Print server url. |
49 GURL cloud_print_server_url_; | 53 GURL cloud_print_server_url_; |
50 // The CloudPrintURLFetcher instance for the current request. | 54 // The CloudPrintURLFetcher instance for the current request. |
51 scoped_refptr<CloudPrintURLFetcher> request_; | 55 scoped_refptr<CloudPrintURLFetcher> request_; |
52 // Auth token. | 56 // Auth token. |
53 std::string auth_token_; | 57 std::string auth_token_; |
54 // List of printer to unregister | 58 // List of printer to unregister |
55 std::list<std::string> printer_ids_; | 59 std::list<std::string> printer_ids_; |
| 60 // Partial network traffic annotation for network requests. |
| 61 const net::PartialNetworkTrafficAnnotationTag partial_traffic_annotation_; |
56 | 62 |
57 DISALLOW_COPY_AND_ASSIGN(CloudPrintWipeout); | 63 DISALLOW_COPY_AND_ASSIGN(CloudPrintWipeout); |
58 }; | 64 }; |
59 | 65 |
60 } // namespace cloud_print | 66 } // namespace cloud_print |
61 | 67 |
62 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ | 68 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ |
63 | 69 |
OLD | NEW |