Index: chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.cc |
diff --git a/chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.cc b/chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b5a388a0e6606b3b9adcdad05fec4fa72e12b8db |
--- /dev/null |
+++ b/chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.cc |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/webui/signin/profile_signin_confirmation_handler.h" |
+ |
+#include "base/bind.h" |
+#include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" |
+#include "content/public/browser/web_ui.h" |
+#include "ui/base/ui_base_types.h" |
+ |
+ProfileSigninConfirmationHandler::ProfileSigninConfirmationHandler( |
+ ProfileSigninConfirmationDialog* dialog, |
+ const base::Closure& cancel_signin, |
+ const base::Closure& signin_with_new_profile, |
+ const base::Closure& continue_signin) |
+ : dialog_(dialog), |
+ cancel_signin_(cancel_signin), |
+ signin_with_new_profile_(signin_with_new_profile), |
+ continue_signin_(continue_signin) { |
+} |
+ |
+ProfileSigninConfirmationHandler::~ProfileSigninConfirmationHandler() { |
+} |
+ |
+void ProfileSigninConfirmationHandler::RegisterMessages() { |
+ web_ui()->RegisterMessageCallback("cancel", |
+ 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
|
+ base::Unretained(this))); |
Andrew T Wilson (Slow)
2013/02/10 20:47:26
Are we guaranteed that we'll outlive the web_ui? I
|
+ web_ui()->RegisterMessageCallback("createNewProfile", |
+ base::Bind(&ProfileSigninConfirmationHandler::OnCreateProfileClicked, |
+ base::Unretained(this))); |
+ web_ui()->RegisterMessageCallback("continue", |
+ base::Bind(&ProfileSigninConfirmationHandler::OnContinueButtonClicked, |
+ base::Unretained(this))); |
+} |
+ |
+void ProfileSigninConfirmationHandler::OnCancelButtonClicked( |
+ const base::ListValue* args) { |
+ // 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
|
+ cancel_signin_.Run(); |
+ dialog_->Close(); |
+} |
+ |
+void ProfileSigninConfirmationHandler::OnCreateProfileClicked( |
+ const base::ListValue* args) { |
+ signin_with_new_profile_.Run(); |
+ dialog_->Close(); |
+} |
+ |
+void ProfileSigninConfirmationHandler::OnContinueButtonClicked( |
+ const base::ListValue* args) { |
+ continue_signin_.Run(); |
+ dialog_->Close(); |
+} |