Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2261)

Unified Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc

Issue 23780002: Actual cancelation of registration when cancel buttons pressed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
index f58167b82fc049860d684cec0003515c3d7a8080..1895c94dbbad88901dd15b4b7bd03f0839bd6d59 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
@@ -41,6 +41,7 @@ LocalDiscoveryUIHandler::LocalDiscoveryUIHandler(
}
LocalDiscoveryUIHandler::~LocalDiscoveryUIHandler() {
+ ResetCurrentRegistration();
SetIsVisible(false);
if (service_discovery_client_.get()) {
service_discovery_client_ = NULL;
@@ -77,6 +78,9 @@ void LocalDiscoveryUIHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("chooseUser", base::Bind(
&LocalDiscoveryUIHandler::HandleChooseUser,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("cancelRegistration", base::Bind(
+ &LocalDiscoveryUIHandler::HandleCancelRegistration,
+ base::Unretained(this)));
}
void LocalDiscoveryUIHandler::HandleStart(const base::ListValue* args) {
@@ -137,6 +141,11 @@ void LocalDiscoveryUIHandler::HandleChooseUser(const base::ListValue* args) {
privet_resolution_->Start();
}
+void LocalDiscoveryUIHandler::HandleCancelRegistration(
+ const base::ListValue* args) {
+ ResetCurrentRegistration();
+}
+
void LocalDiscoveryUIHandler::StartRegisterHTTP(
const std::string& user,
scoped_ptr<PrivetHTTPClient> http_client) {
@@ -353,4 +362,20 @@ void LocalDiscoveryUIHandler::StartCookieConfirmFlow(
confirm_api_call_flow_->Start();
}
+// TODO(noamsml): Create master object for registration flow.
+void LocalDiscoveryUIHandler::ResetCurrentRegistration() {
+ current_register_device_.clear();
+ if (current_register_operation_.get()) {
+ current_register_operation_->Cancel();
+ current_register_operation_.reset();
+ }
+
+ confirm_api_call_flow_.reset();
+ privet_resolution_.reset();
+ cloud_print_account_manager_.reset();
+ xsrf_token_for_primary_user_.clear();
+ current_register_user_index_ = 0;
+ current_http_client_.reset();
+}
+
} // namespace local_discovery
« no previous file with comments | « chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698