Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" | |
| 9 #include "content/public/browser/web_ui.h" | |
| 10 #include "ui/base/ui_base_types.h" | |
| 11 | |
| 12 ProfileSigninConfirmationHandler::ProfileSigninConfirmationHandler( | |
| 13 ProfileSigninConfirmationDialog* dialog, | |
| 14 const base::Closure& cancel_signin, | |
| 15 const base::Closure& signin_with_new_profile, | |
| 16 const base::Closure& continue_signin) | |
| 17 : dialog_(dialog), | |
| 18 cancel_signin_(cancel_signin), | |
| 19 signin_with_new_profile_(signin_with_new_profile), | |
| 20 continue_signin_(continue_signin) { | |
| 21 } | |
| 22 | |
| 23 ProfileSigninConfirmationHandler::~ProfileSigninConfirmationHandler() { | |
| 24 } | |
| 25 | |
| 26 void ProfileSigninConfirmationHandler::RegisterMessages() { | |
| 27 web_ui()->RegisterMessageCallback("cancel", | |
| 28 base::Bind(&ProfileSigninConfirmationHandler::OnCancelButtonClicked, | |
|
Andrew T Wilson (Slow)
2013/02/10 20:47:26
See my earlier point - if you roll this into the D
| |
| 29 base::Unretained(this))); | |
|
Andrew T Wilson (Slow)
2013/02/10 20:47:26
Are we guaranteed that we'll outlive the web_ui? I
| |
| 30 web_ui()->RegisterMessageCallback("createNewProfile", | |
| 31 base::Bind(&ProfileSigninConfirmationHandler::OnCreateProfileClicked, | |
| 32 base::Unretained(this))); | |
| 33 web_ui()->RegisterMessageCallback("continue", | |
| 34 base::Bind(&ProfileSigninConfirmationHandler::OnContinueButtonClicked, | |
| 35 base::Unretained(this))); | |
| 36 } | |
| 37 | |
| 38 void ProfileSigninConfirmationHandler::OnCancelButtonClicked( | |
| 39 const base::ListValue* args) { | |
| 40 // TODO(dconnelly): redirect back to NTP? | |
|
Andrew T Wilson (Slow)
2013/02/10 20:47:26
Yeah, I'm not sure about what to do about redirect
| |
| 41 cancel_signin_.Run(); | |
| 42 dialog_->Close(); | |
| 43 } | |
| 44 | |
| 45 void ProfileSigninConfirmationHandler::OnCreateProfileClicked( | |
| 46 const base::ListValue* args) { | |
| 47 signin_with_new_profile_.Run(); | |
| 48 dialog_->Close(); | |
| 49 } | |
| 50 | |
| 51 void ProfileSigninConfirmationHandler::OnContinueButtonClicked( | |
| 52 const base::ListValue* args) { | |
| 53 continue_signin_.Run(); | |
| 54 dialog_->Close(); | |
| 55 } | |
| OLD | NEW |