| 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
|
|
|