| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/sync_setup_flow.h" | 5 #include "chrome/browser/sync/sync_setup_flow.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 void SyncSetupFlow::Focus() { | 201 void SyncSetupFlow::Focus() { |
| 202 // This gets called from SyncSetupWizard::Focus(), and might get called | 202 // This gets called from SyncSetupWizard::Focus(), and might get called |
| 203 // before flow_handler_ is set in AttachSyncSetupHandler() (which gets | 203 // before flow_handler_ is set in AttachSyncSetupHandler() (which gets |
| 204 // called asynchronously after the UI initializes). | 204 // called asynchronously after the UI initializes). |
| 205 if (flow_handler_) | 205 if (flow_handler_) |
| 206 flow_handler_->Focus(); | 206 flow_handler_->Focus(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void SyncSetupFlow::ShowSyncSetup() { |
| 210 flow_handler_->ShowSyncSetup(service_->profile()); |
| 211 } |
| 212 |
| 209 // A callback to notify the delegate that the dialog closed. | 213 // A callback to notify the delegate that the dialog closed. |
| 210 void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { | 214 void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { |
| 211 DCHECK(json_retval.empty()); | 215 DCHECK(json_retval.empty()); |
| 212 container_->set_flow(NULL); // Sever ties from the wizard. | 216 container_->set_flow(NULL); // Sever ties from the wizard. |
| 213 if (current_state_ == SyncSetupWizard::DONE) | 217 if (current_state_ == SyncSetupWizard::DONE) |
| 214 service_->SetSyncSetupCompleted(); | 218 service_->SetSyncSetupCompleted(); |
| 215 | 219 |
| 216 // Record the state at which the user cancelled the signon dialog. | 220 // Record the state at which the user cancelled the signon dialog. |
| 217 switch (current_state_) { | 221 switch (current_state_) { |
| 218 case SyncSetupWizard::GAIA_LOGIN: | 222 case SyncSetupWizard::GAIA_LOGIN: |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 break; | 413 break; |
| 410 } | 414 } |
| 411 case SyncSetupWizard::DONE: | 415 case SyncSetupWizard::DONE: |
| 412 flow_handler_->ShowSetupDone( | 416 flow_handler_->ShowSetupDone( |
| 413 UTF16ToWide(service_->GetAuthenticatedUsername())); | 417 UTF16ToWide(service_->GetAuthenticatedUsername())); |
| 414 break; | 418 break; |
| 415 default: | 419 default: |
| 416 NOTREACHED() << "Invalid advance state: " << state; | 420 NOTREACHED() << "Invalid advance state: " << state; |
| 417 } | 421 } |
| 418 } | 422 } |
| OLD | NEW |