| 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> |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void HandleRequestDeviceList(const base::ListValue* args); | 106 void HandleRequestDeviceList(const base::ListValue* args); |
| 107 | 107 |
| 108 // For opening URLs (relative to the Google Cloud Print base URL) in a new | 108 // For opening URLs (relative to the Google Cloud Print base URL) in a new |
| 109 // tab. | 109 // tab. |
| 110 void HandleOpenCloudPrintURL(const base::ListValue* args); | 110 void HandleOpenCloudPrintURL(const base::ListValue* args); |
| 111 | 111 |
| 112 // For showing sync login UI. | 112 // For showing sync login UI. |
| 113 void HandleShowSyncUI(const base::ListValue* args); | 113 void HandleShowSyncUI(const base::ListValue* args); |
| 114 | 114 |
| 115 // For when the IP address of the printer has been resolved for registration. | 115 // For when the IP address of the printer has been resolved for registration. |
| 116 void StartRegisterHTTP(scoped_ptr<cloud_print::PrivetHTTPClient> http_client); | 116 void StartRegisterHTTP( |
| 117 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
| 117 | 118 |
| 118 // For when the confirm operation on the cloudprint server has finished | 119 // For when the confirm operation on the cloudprint server has finished |
| 119 // executing. | 120 // executing. |
| 120 void OnConfirmDone(cloud_print::GCDApiFlow::Status status); | 121 void OnConfirmDone(cloud_print::GCDApiFlow::Status status); |
| 121 | 122 |
| 122 // Signal to the web interface an error has ocurred while registering. | 123 // Signal to the web interface an error has ocurred while registering. |
| 123 void SendRegisterError(); | 124 void SendRegisterError(); |
| 124 | 125 |
| 125 // Singal to the web interface that registration has finished. | 126 // Singal to the web interface that registration has finished. |
| 126 void SendRegisterDone(const std::string& service_name); | 127 void SendRegisterDone(const std::string& service_name); |
| 127 | 128 |
| 128 // Set the visibility of the page. | 129 // Set the visibility of the page. |
| 129 void SetIsVisible(bool visible); | 130 void SetIsVisible(bool visible); |
| 130 | 131 |
| 131 // Get the sync account email. | 132 // Get the sync account email. |
| 132 std::string GetSyncAccount(); | 133 std::string GetSyncAccount(); |
| 133 | 134 |
| 134 // Reset and cancel the current registration. | 135 // Reset and cancel the current registration. |
| 135 void ResetCurrentRegistration(); | 136 void ResetCurrentRegistration(); |
| 136 | 137 |
| 137 scoped_ptr<cloud_print::GCDApiFlow> CreateApiFlow(); | 138 std::unique_ptr<cloud_print::GCDApiFlow> CreateApiFlow(); |
| 138 void OnSetupError(); | 139 void OnSetupError(); |
| 139 | 140 |
| 140 // Announcement hasn't been sent for a certain time after registration | 141 // Announcement hasn't been sent for a certain time after registration |
| 141 // finished. Consider it failed. | 142 // finished. Consider it failed. |
| 142 // TODO(noamsml): Re-resolve service first. | 143 // TODO(noamsml): Re-resolve service first. |
| 143 void OnAnnouncementTimeoutReached(); | 144 void OnAnnouncementTimeoutReached(); |
| 144 | 145 |
| 145 void CheckUserLoggedIn(); | 146 void CheckUserLoggedIn(); |
| 146 | 147 |
| 147 void CheckListingDone(); | 148 void CheckListingDone(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 158 void RefreshCloudPrintStatusFromService(); | 159 void RefreshCloudPrintStatusFromService(); |
| 159 #endif | 160 #endif |
| 160 | 161 |
| 161 // A map of current device descriptions provided by the PrivetDeviceLister. | 162 // A map of current device descriptions provided by the PrivetDeviceLister. |
| 162 DeviceDescriptionMap device_descriptions_; | 163 DeviceDescriptionMap device_descriptions_; |
| 163 | 164 |
| 164 // The service discovery client used listen for devices on the local network. | 165 // The service discovery client used listen for devices on the local network. |
| 165 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 166 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; |
| 166 | 167 |
| 167 // A factory for creating the privet HTTP Client. | 168 // A factory for creating the privet HTTP Client. |
| 168 scoped_ptr<cloud_print::PrivetHTTPAsynchronousFactory> privet_http_factory_; | 169 std::unique_ptr<cloud_print::PrivetHTTPAsynchronousFactory> |
| 170 privet_http_factory_; |
| 169 | 171 |
| 170 // An object representing the resolution process for the privet_http_factory. | 172 // An object representing the resolution process for the privet_http_factory. |
| 171 scoped_ptr<cloud_print::PrivetHTTPResolution> privet_resolution_; | 173 std::unique_ptr<cloud_print::PrivetHTTPResolution> privet_resolution_; |
| 172 | 174 |
| 173 // The current HTTP client (used for the current operation). | 175 // The current HTTP client (used for the current operation). |
| 174 scoped_ptr<cloud_print::PrivetV1HTTPClient> current_http_client_; | 176 std::unique_ptr<cloud_print::PrivetV1HTTPClient> current_http_client_; |
| 175 | 177 |
| 176 // The current register operation. Only one allowed at any time. | 178 // The current register operation. Only one allowed at any time. |
| 177 scoped_ptr<cloud_print::PrivetRegisterOperation> current_register_operation_; | 179 std::unique_ptr<cloud_print::PrivetRegisterOperation> |
| 180 current_register_operation_; |
| 178 | 181 |
| 179 // The current confirm call used during the registration flow. | 182 // The current confirm call used during the registration flow. |
| 180 scoped_ptr<cloud_print::GCDApiFlow> confirm_api_call_flow_; | 183 std::unique_ptr<cloud_print::GCDApiFlow> confirm_api_call_flow_; |
| 181 | 184 |
| 182 // The device lister used to list devices on the local network. | 185 // The device lister used to list devices on the local network. |
| 183 scoped_ptr<cloud_print::PrivetDeviceLister> privet_lister_; | 186 std::unique_ptr<cloud_print::PrivetDeviceLister> privet_lister_; |
| 184 | 187 |
| 185 // Whether or not the page is marked as visible. | 188 // Whether or not the page is marked as visible. |
| 186 bool is_visible_; | 189 bool is_visible_; |
| 187 | 190 |
| 188 // List of printers from cloud print. | 191 // List of printers from cloud print. |
| 189 scoped_ptr<cloud_print::GCDApiFlow> cloud_print_printer_list_; | 192 std::unique_ptr<cloud_print::GCDApiFlow> cloud_print_printer_list_; |
| 190 std::vector<cloud_print::CloudPrintPrinterList::Device> cloud_devices_; | 193 std::vector<cloud_print::CloudPrintPrinterList::Device> cloud_devices_; |
| 191 int failed_list_count_; | 194 int failed_list_count_; |
| 192 int succeded_list_count_; | 195 int succeded_list_count_; |
| 193 | 196 |
| 194 #if defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) | 197 #if defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) |
| 195 StringPrefMember cloud_print_connector_email_; | 198 StringPrefMember cloud_print_connector_email_; |
| 196 BooleanPrefMember cloud_print_connector_enabled_; | 199 BooleanPrefMember cloud_print_connector_enabled_; |
| 197 bool cloud_print_connector_ui_enabled_; | 200 bool cloud_print_connector_ui_enabled_; |
| 198 #endif | 201 #endif |
| 199 | 202 |
| 200 DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUIHandler); | 203 DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUIHandler); |
| 201 }; | 204 }; |
| 202 | 205 |
| 203 #undef CLOUD_PRINT_CONNECTOR_UI_AVAILABLE | 206 #undef CLOUD_PRINT_CONNECTOR_UI_AVAILABLE |
| 204 | 207 |
| 205 } // namespace local_discovery | 208 } // namespace local_discovery |
| 206 #endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ | 209 #endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
| OLD | NEW |