Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h |
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h |
index f2b7eec9a3495bb856c68662ba700ea5f7a4a512..72f4682fc111bddbca18c302b2e9f9ee80f650d8 100644 |
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h |
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h |
@@ -5,27 +5,84 @@ |
#ifndef CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
#define CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_HANDLER_H_ |
+#include <map> |
+#include <string> |
+ |
+#include "chrome/browser/local_discovery/privet_confirm_api_flow.h" |
+#include "chrome/browser/local_discovery/privet_device_lister.h" |
+#include "chrome/browser/local_discovery/privet_http.h" |
+#include "chrome/browser/local_discovery/service_discovery_host_client.h" |
+#include "chrome/common/local_discovery/service_discovery_client.h" |
#include "content/public/browser/user_metrics.h" |
#include "content/public/browser/web_ui_message_handler.h" |
// UI Handler for chrome://devices/ |
Vitaly Buka (NO REVIEWS)
2013/07/24 01:27:54
you can put this class in local_discovery namespac
Noam Samuel
2013/07/24 17:57:32
Done.
|
// It listens to local discovery notifications and passes those notifications |
// into the Javascript to update the page. |
-class LocalDiscoveryUIHandler : public content::WebUIMessageHandler { |
+class LocalDiscoveryUIHandler |
+ : public content::WebUIMessageHandler, |
+ public local_discovery::PrivetRegisterOperation::Delegate, |
+ public local_discovery::PrivetDeviceLister::Delegate { |
public: |
LocalDiscoveryUIHandler(); |
virtual ~LocalDiscoveryUIHandler(); |
- // WebUIMessageHandler implementation. |
- // Does nothing for now. |
+ // WebUIMessageHandler implementation: |
virtual void RegisterMessages() OVERRIDE; |
+ // PrivetRegisterOperation::Delegate implementation: |
+ virtual void OnPrivetRegisterClaimToken(const std::string& token, |
+ const GURL& url) OVERRIDE; |
+ |
+ virtual void OnPrivetRegisterError( |
+ const std::string& action, |
+ local_discovery::PrivetRegisterOperation::FailureReason reason, |
+ int printer_http_code, |
+ const DictionaryValue* json) OVERRIDE; |
+ |
+ virtual void OnPrivetRegisterDone(const std::string& device_id) OVERRIDE; |
+ |
+ // PrivetDeviceLister::Delegate implementation: |
+ virtual void DeviceChanged( |
+ bool added, |
+ const std::string& name, |
+ const local_discovery::DeviceDescription& description) OVERRIDE; |
+ virtual void DeviceRemoved(const std::string& name) OVERRIDE; |
+ |
private: |
- // Callback for adding new device to the devices page. |
- // |name| contains a user friendly name of the device. |
- void OnNewDevice(const std::string& name); |
+ // Message handlers: |
+ // For registering a device. |
+ void OnRegisterDevice(const base::ListValue* data); |
+ // For when the page is ready to recieve device notifications. |
+ void OnStart(const base::ListValue* value); |
+ |
+ // For when the IP address of the printer has been resolved. |
+ void OnDomainResolved(bool success, const net::IPAddressNumber& address); |
+ |
+ // For when the confirm operation on the cloudprint server has finished |
+ // executing. |
+ void OnConfirmDone(local_discovery::PrivetConfirmApiCallFlow::Status status); |
+ |
+ // Log an error to the web interface. |
+ void LogRegisterErrorToWeb(const std::string& error); |
+ |
+ // Log a successful registration to the web inteface. |
+ void LogRegisterDoneToWeb(const std::string& id); |
+ |
+ scoped_ptr<local_discovery::PrivetHTTPClient> current_http_client_; |
Vitaly Buka (NO REVIEWS)
2013/07/24 01:27:54
and remove local_discovery::
Noam Samuel
2013/07/24 17:57:32
Done.
|
+ scoped_ptr<local_discovery::PrivetRegisterOperation> |
+ current_register_operation_; |
+ scoped_ptr<local_discovery::PrivetConfirmApiCallFlow> confirm_api_call_flow_; |
+ std::string currently_registering_device_; |
+ |
+ scoped_ptr<local_discovery::PrivetDeviceLister> privet_lister_; |
+ scoped_refptr<local_discovery::ServiceDiscoveryHostClient> |
+ service_discovery_client_; |
+ |
+ std::map<std::string, local_discovery::DeviceDescription> |
+ device_descriptions_; |
- content::ActionCallback action_callback_; |
+ scoped_ptr<local_discovery::LocalDomainResolver> domain_resolver_; |
DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUIHandler); |
}; |