| 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_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> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 DictionaryValue* json_data, | 61 DictionaryValue* json_data, |
| 62 bool succeeded); | 62 bool succeeded); |
| 63 | 63 |
| 64 enum PendingTaskType { | 64 enum PendingTaskType { |
| 65 PENDING_PRINTERS_NONE, | 65 PENDING_PRINTERS_NONE, |
| 66 PENDING_PRINTERS_AVAILABLE, | 66 PENDING_PRINTERS_AVAILABLE, |
| 67 PENDING_PRINTER_REGISTER, | 67 PENDING_PRINTER_REGISTER, |
| 68 PENDING_PRINTER_DELETE | 68 PENDING_PRINTER_DELETE |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // TODO(jhawkins): This name conflicts with base::PendingTask. | 71 // TODO(vitalybuka): Consider delete pending_tasks_ and just use MessageLoop. |
| 72 struct PendingTask { | 72 struct PendingTask { |
| 73 PendingTaskType type; | 73 PendingTaskType type; |
| 74 // Optional members, depending on type. | 74 // Optional members, depending on type. |
| 75 std::string printer_id; // For pending delete. | 75 std::string printer_id; // For pending delete. |
| 76 std::string display_name; // For pending register. |
| 76 printing::PrinterBasicInfo printer_info; // For pending registration. | 77 printing::PrinterBasicInfo printer_info; // For pending registration. |
| 77 | 78 |
| 78 PendingTask() : type(PENDING_PRINTERS_NONE) {} | 79 PendingTask(); |
| 79 ~PendingTask() {} | 80 ~PendingTask(); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 virtual ~CloudPrintConnector(); | 83 virtual ~CloudPrintConnector(); |
| 83 // PrintServerWatcherDelegate implementation | 84 // PrintServerWatcherDelegate implementation |
| 84 virtual void OnPrinterAdded() OVERRIDE; | 85 virtual void OnPrinterAdded() OVERRIDE; |
| 85 // PrinterJobHandler::Delegate implementation | 86 // PrinterJobHandler::Delegate implementation |
| 86 virtual void OnPrinterDeleted(const std::string& printer_name) OVERRIDE; | 87 virtual void OnPrinterDeleted(const std::string& printer_name) OVERRIDE; |
| 87 virtual void OnAuthError() OVERRIDE; | 88 virtual void OnAuthError() OVERRIDE; |
| 88 | 89 |
| 89 // CloudPrintURLFetcher::Delegate implementation. | 90 // CloudPrintURLFetcher::Delegate implementation. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void ReportUserMessage(const std::string& message_id, | 134 void ReportUserMessage(const std::string& message_id, |
| 134 const std::string& failure_message); | 135 const std::string& failure_message); |
| 135 | 136 |
| 136 bool RemovePrinterFromList(const std::string& printer_name, | 137 bool RemovePrinterFromList(const std::string& printer_name, |
| 137 printing::PrinterList* printer_list); | 138 printing::PrinterList* printer_list); |
| 138 | 139 |
| 139 void InitJobHandlerForPrinter(DictionaryValue* printer_data); | 140 void InitJobHandlerForPrinter(DictionaryValue* printer_data); |
| 140 | 141 |
| 141 void AddPendingAvailableTask(); | 142 void AddPendingAvailableTask(); |
| 142 void AddPendingDeleteTask(const std::string& id); | 143 void AddPendingDeleteTask(const std::string& id); |
| 143 void AddPendingRegisterTask(const printing::PrinterBasicInfo& info); | 144 void AddPendingRegisterTask(const printing::PrinterBasicInfo& info, |
| 145 const std::string& display_name); |
| 144 void AddPendingTask(const PendingTask& task); | 146 void AddPendingTask(const PendingTask& task); |
| 145 void ProcessPendingTask(); | 147 void ProcessPendingTask(); |
| 146 void ContinuePendingTaskProcessing(); | 148 void ContinuePendingTaskProcessing(); |
| 147 void OnPrintersAvailable(); | 149 void OnPrintersAvailable(); |
| 148 void OnPrinterRegister(const printing::PrinterBasicInfo& info); | 150 void OnPrinterRegister(const printing::PrinterBasicInfo& info, |
| 151 const std::string& display_name); |
| 149 void OnPrinterDelete(const std::string& name); | 152 void OnPrinterDelete(const std::string& name); |
| 150 | 153 |
| 151 void OnReceivePrinterCaps( | 154 void OnReceivePrinterCaps( |
| 155 const std::string& display_name, |
| 152 bool succeeded, | 156 bool succeeded, |
| 153 const std::string& printer_name, | 157 const std::string& printer_name, |
| 154 const printing::PrinterCapsAndDefaults& caps_and_defaults); | 158 const printing::PrinterCapsAndDefaults& caps_and_defaults); |
| 155 | 159 |
| 156 // Register printer from the list. | 160 // Register printer from the list. |
| 157 void RegisterPrinters(const printing::PrinterList& printers); | 161 void RegisterPrinters(const printing::PrinterList& printers); |
| 158 | 162 |
| 159 bool IsSamePrinter(const std::string& name1, const std::string& name2) const; | 163 bool IsSamePrinter(const std::string& name1, const std::string& name2) const; |
| 160 bool InitPrintSystem(); | 164 bool InitPrintSystem(); |
| 161 | 165 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 181 // The CloudPrintURLFetcher instance for the user message request. | 185 // The CloudPrintURLFetcher instance for the user message request. |
| 182 scoped_refptr<CloudPrintURLFetcher> user_message_request_; | 186 scoped_refptr<CloudPrintURLFetcher> user_message_request_; |
| 183 | 187 |
| 184 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); | 188 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); |
| 185 }; | 189 }; |
| 186 | 190 |
| 187 } // namespace cloud_print | 191 } // namespace cloud_print |
| 188 | 192 |
| 189 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ | 193 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ |
| 190 | 194 |
| OLD | NEW |