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_JOB_STATUS_UPDATER_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_JOB_STATUS_UPDATER_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_JOB_STATUS_UPDATER_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_JOB_STATUS_UPDATER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 PlatformJobId& local_job_id, | 38 PlatformJobId& local_job_id, |
39 const GURL& cloud_print_server_url, | 39 const GURL& cloud_print_server_url, |
40 PrintSystem* print_system, | 40 PrintSystem* print_system, |
41 Delegate* delegate); | 41 Delegate* delegate); |
42 | 42 |
43 // Checks the status of the local print job and sends an update. | 43 // Checks the status of the local print job and sends an update. |
44 void UpdateStatus(); | 44 void UpdateStatus(); |
45 void Stop(); | 45 void Stop(); |
46 | 46 |
47 // CloudPrintURLFetcher::Delegate implementation. | 47 // CloudPrintURLFetcher::Delegate implementation. |
48 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( | 48 CloudPrintURLFetcher::ResponseAction HandleJSONData( |
49 const net::URLFetcher* source, | 49 const net::URLFetcher* source, |
50 const GURL& url, | 50 const GURL& url, |
51 base::DictionaryValue* json_data, | 51 base::DictionaryValue* json_data, |
52 bool succeeded) override; | 52 bool succeeded) override; |
53 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; | 53 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; |
54 virtual std::string GetAuthHeader() override; | 54 std::string GetAuthHeader() override; |
55 | 55 |
56 base::Time start_time() const { | 56 base::Time start_time() const { |
57 return start_time_; | 57 return start_time_; |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 friend class base::RefCountedThreadSafe<JobStatusUpdater>; | 61 friend class base::RefCountedThreadSafe<JobStatusUpdater>; |
62 virtual ~JobStatusUpdater(); | 62 ~JobStatusUpdater() override; |
63 | 63 |
64 base::Time start_time_; | 64 base::Time start_time_; |
65 std::string printer_name_; | 65 std::string printer_name_; |
66 std::string job_id_; | 66 std::string job_id_; |
67 PlatformJobId local_job_id_; | 67 PlatformJobId local_job_id_; |
68 PrintJobDetails last_job_details_; | 68 PrintJobDetails last_job_details_; |
69 scoped_refptr<CloudPrintURLFetcher> request_; | 69 scoped_refptr<CloudPrintURLFetcher> request_; |
70 GURL cloud_print_server_url_; | 70 GURL cloud_print_server_url_; |
71 scoped_refptr<PrintSystem> print_system_; | 71 scoped_refptr<PrintSystem> print_system_; |
72 Delegate* delegate_; | 72 Delegate* delegate_; |
73 // A flag that is set to true in Stop() and will ensure the next scheduled | 73 // A flag that is set to true in Stop() and will ensure the next scheduled |
74 // task will do nothing. | 74 // task will do nothing. |
75 bool stopped_; | 75 bool stopped_; |
76 DISALLOW_COPY_AND_ASSIGN(JobStatusUpdater); | 76 DISALLOW_COPY_AND_ASSIGN(JobStatusUpdater); |
77 }; | 77 }; |
78 | 78 |
79 // This typedef is to workaround the issue with certain versions of | 79 // This typedef is to workaround the issue with certain versions of |
80 // Visual Studio where it gets confused between multiple Delegate | 80 // Visual Studio where it gets confused between multiple Delegate |
81 // classes and gives a C2500 error. (I saw this error on the try bots - | 81 // classes and gives a C2500 error. (I saw this error on the try bots - |
82 // the workaround was not needed for my machine). | 82 // the workaround was not needed for my machine). |
83 typedef JobStatusUpdater::Delegate JobStatusUpdaterDelegate; | 83 typedef JobStatusUpdater::Delegate JobStatusUpdaterDelegate; |
84 | 84 |
85 } // namespace cloud_print | 85 } // namespace cloud_print |
86 | 86 |
87 #endif // CHROME_SERVICE_CLOUD_PRINT_JOB_STATUS_UPDATER_H_ | 87 #endif // CHROME_SERVICE_CLOUD_PRINT_JOB_STATUS_UPDATER_H_ |
OLD | NEW |