| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "chrome/browser/local_discovery/cloud_print_account_manager.h" | |
| 14 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" | 13 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" |
| 15 #include "chrome/browser/local_discovery/privet_confirm_api_flow.h" | |
| 16 #include "chrome/browser/local_discovery/privet_constants.h" | |
| 17 #include "chrome/browser/local_discovery/privet_device_lister.h" | 14 #include "chrome/browser/local_discovery/privet_device_lister.h" |
| 18 #include "chrome/browser/local_discovery/privet_http.h" | 15 #include "chrome/browser/local_discovery/privet_http.h" |
| 19 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | |
| 20 #include "chrome/browser/local_discovery/service_discovery_host_client.h" | |
| 21 #include "chrome/common/local_discovery/service_discovery_client.h" | |
| 22 #include "content/public/browser/user_metrics.h" | |
| 23 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
| 24 | 17 |
| 25 // TODO(noamsml): Factor out full registration flow into single class | 18 // TODO(noamsml): Factor out full registration flow into single class |
| 26 namespace local_discovery { | 19 namespace local_discovery { |
| 27 | 20 |
| 21 class PrivetConfirmApiCallFlow; |
| 22 class PrivetHTTPAsynchronousFactory; |
| 23 class PrivetHTTPResolution; |
| 24 class ServiceDiscoveryHostClient; |
| 25 |
| 28 // UI Handler for chrome://devices/ | 26 // UI Handler for chrome://devices/ |
| 29 // It listens to local discovery notifications and passes those notifications | 27 // It listens to local discovery notifications and passes those notifications |
| 30 // into the Javascript to update the page. | 28 // into the Javascript to update the page. |
| 31 class LocalDiscoveryUIHandler : public content::WebUIMessageHandler, | 29 class LocalDiscoveryUIHandler : public content::WebUIMessageHandler, |
| 32 public PrivetRegisterOperation::Delegate, | 30 public PrivetRegisterOperation::Delegate, |
| 33 public PrivetDeviceLister::Delegate, | 31 public PrivetDeviceLister::Delegate, |
| 34 public CloudPrintPrinterList::Delegate { | 32 public CloudPrintPrinterList::Delegate { |
| 35 public: | 33 public: |
| 36 class Factory { | 34 class Factory { |
| 37 public: | 35 public: |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // The device lister used to list devices on the local network. | 156 // The device lister used to list devices on the local network. |
| 159 scoped_ptr<PrivetDeviceLister> privet_lister_; | 157 scoped_ptr<PrivetDeviceLister> privet_lister_; |
| 160 | 158 |
| 161 // The service discovery client used listen for devices on the local network. | 159 // The service discovery client used listen for devices on the local network. |
| 162 scoped_refptr<ServiceDiscoveryHostClient> service_discovery_client_; | 160 scoped_refptr<ServiceDiscoveryHostClient> service_discovery_client_; |
| 163 | 161 |
| 164 // A factory for creating the privet HTTP Client. | 162 // A factory for creating the privet HTTP Client. |
| 165 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory_; | 163 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory_; |
| 166 | 164 |
| 167 // An object representing the resolution process for the privet_http_factory. | 165 // An object representing the resolution process for the privet_http_factory. |
| 168 scoped_ptr<PrivetHTTPAsynchronousFactory::Resolution> privet_resolution_; | 166 scoped_ptr<PrivetHTTPResolution> privet_resolution_; |
| 169 | 167 |
| 170 // A map of current device descriptions provided by the PrivetDeviceLister. | 168 // A map of current device descriptions provided by the PrivetDeviceLister. |
| 171 DeviceDescriptionMap device_descriptions_; | 169 DeviceDescriptionMap device_descriptions_; |
| 172 | 170 |
| 173 // Whether or not the page is marked as visible. | 171 // Whether or not the page is marked as visible. |
| 174 bool is_visible_; | 172 bool is_visible_; |
| 175 | 173 |
| 176 // Device whose state must be updated to "registered" to complete | 174 // Device whose state must be updated to "registered" to complete |
| 177 // registration. | 175 // registration. |
| 178 std::string new_register_device_; | 176 std::string new_register_device_; |
| 179 | 177 |
| 180 // List of printers from cloud print. | 178 // List of printers from cloud print. |
| 181 scoped_ptr<CloudPrintPrinterList> cloud_print_printer_list_; | 179 scoped_ptr<CloudPrintPrinterList> cloud_print_printer_list_; |
| 182 | 180 |
| 183 // Announcement timeout for registration. | 181 // Announcement timeout for registration. |
| 184 base::CancelableCallback<void()> registration_announce_timeout_; | 182 base::CancelableCallback<void()> registration_announce_timeout_; |
| 185 | 183 |
| 186 DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUIHandler); | 184 DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUIHandler); |
| 187 }; | 185 }; |
| 188 | 186 |
| 189 } // namespace local_discovery | 187 } // namespace local_discovery |
| 190 #endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ | 188 #endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
| OLD | NEW |