| 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_PROXY_BACKEND_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_ |
| 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // The print system could not be initialized. | 40 // The print system could not be initialized. |
| 41 virtual void OnPrintSystemUnavailable() = 0; | 41 virtual void OnPrintSystemUnavailable() = 0; |
| 42 // Receive auth token and list of printers. | 42 // Receive auth token and list of printers. |
| 43 virtual void OnUnregisterPrinters( | 43 virtual void OnUnregisterPrinters( |
| 44 const std::string& auth_token, | 44 const std::string& auth_token, |
| 45 const std::list<std::string>& printer_ids) = 0; | 45 const std::list<std::string>& printer_ids) = 0; |
| 46 // Update and store service settings. | 46 // Update and store service settings. |
| 47 virtual void OnXmppPingUpdated(int ping_timeout) = 0; | 47 virtual void OnXmppPingUpdated(int ping_timeout) = 0; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 // Don't delete through SyncFrontend interface. | 50 // Don't delete through CloudPrintProxyFrontend interface. |
| 51 virtual ~CloudPrintProxyFrontend() {} | 51 virtual ~CloudPrintProxyFrontend() {} |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyFrontend); | 54 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyFrontend); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class CloudPrintProxyBackend { | 57 class CloudPrintProxyBackend { |
| 58 public: | 58 public: |
| 59 CloudPrintProxyBackend(CloudPrintProxyFrontend* frontend, | 59 CloudPrintProxyBackend(CloudPrintProxyFrontend* frontend, |
| 60 const ConnectorSettings& settings, | 60 const ConnectorSettings& settings, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 72 bool InitializeWithRobotAuthCode(const std::string& robot_oauth_auth_code, | 72 bool InitializeWithRobotAuthCode(const std::string& robot_oauth_auth_code, |
| 73 const std::string& robot_email); | 73 const std::string& robot_email); |
| 74 void Shutdown(); | 74 void Shutdown(); |
| 75 void RegisterPrinters(const printing::PrinterList& printer_list); | 75 void RegisterPrinters(const printing::PrinterList& printer_list); |
| 76 void UnregisterPrinters(); | 76 void UnregisterPrinters(); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 bool PostCoreTask(const tracked_objects::Location& from_here, | 79 bool PostCoreTask(const tracked_objects::Location& from_here, |
| 80 const base::Closure& task); | 80 const base::Closure& task); |
| 81 | 81 |
| 82 // The real guts of SyncBackendHost, to keep the public client API clean. | 82 // The real guts of CloudPrintProxyBackend, to keep the public client API |
| 83 // clean. |
| 83 class Core; | 84 class Core; |
| 84 | 85 |
| 85 // A thread dedicated for use to perform initialization and authentication. | 86 // A thread dedicated for use to perform initialization and authentication. |
| 86 base::Thread core_thread_; | 87 base::Thread core_thread_; |
| 87 | 88 |
| 88 // The core, which communicates with AuthWatcher for GAIA authentication and | 89 // The core, which communicates with AuthWatcher for GAIA authentication and |
| 89 // which contains printer registration code. | 90 // which contains printer registration code. |
| 90 scoped_refptr<Core> core_; | 91 scoped_refptr<Core> core_; |
| 91 | 92 |
| 92 // A reference to the TaskRunner used to construct |this|, so we know how to | 93 // A reference to the TaskRunner used to construct |this|, so we know how to |
| 93 // safely talk back to the SyncFrontend. | 94 // safely talk back to the CloudPrintProxyFrontend. |
| 94 const scoped_refptr<base::SingleThreadTaskRunner> frontend_task_runner_; | 95 const scoped_refptr<base::SingleThreadTaskRunner> frontend_task_runner_; |
| 95 | 96 |
| 96 // The frontend which is responsible for displaying UI and updating Prefs. | 97 // The frontend which is responsible for displaying UI and updating Prefs. |
| 97 // Outlives this backend. | 98 // Outlives this backend. |
| 98 CloudPrintProxyFrontend* const frontend_; | 99 CloudPrintProxyFrontend* const frontend_; |
| 99 | 100 |
| 100 friend class base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>; | 101 friend class base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>; |
| 101 | 102 |
| 102 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyBackend); | 103 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyBackend); |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 } // namespace cloud_print | 106 } // namespace cloud_print |
| 106 | 107 |
| 107 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_ | 108 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_ |
| OLD | NEW |