OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/string16.h" |
| 12 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 13 #include "ui/base/ui_base_types.h" |
| 14 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 15 |
| 16 class Profile; |
| 17 class WebUIMessageHandler; |
| 18 |
| 19 // A tab-modal dialog to allow a user signing in with a managed account |
| 20 // to create a new Chrome profile. |
| 21 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { |
| 22 public: |
| 23 // Creates and shows the modal dialog. |profile| is the current Chrome |
| 24 // profile and |username| is the GAIA username that the user is signing |
| 25 // in with. |
| 26 static void ShowDialog(Profile* profile, |
| 27 const std::string& username, |
| 28 const base::Closure& cancel_signin, |
| 29 const base::Closure& signin_with_new_profile, |
| 30 const base::Closure& continue_signin); |
| 31 |
| 32 // Closes the dialog, which will delete itself. |
| 33 void Close() const; |
| 34 |
| 35 private: |
| 36 ProfileSigninConfirmationDialog( |
| 37 Profile* profile, |
| 38 const std::string& username, |
| 39 const base::Closure& cancel_signin, |
| 40 const base::Closure& signin_with_new_profile, |
| 41 const base::Closure& continue_signin); |
| 42 virtual ~ProfileSigninConfirmationDialog(); |
| 43 |
| 44 // WebDialogDelegate implementation. |
| 45 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
| 46 virtual string16 GetDialogTitle() const OVERRIDE; |
| 47 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 48 virtual void GetWebUIMessageHandlers( |
| 49 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 50 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 51 virtual std::string GetDialogArgs() const OVERRIDE; |
| 52 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 53 virtual void OnCloseContents(content::WebContents* source, |
| 54 bool* out_close_dialog) OVERRIDE; |
| 55 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| 56 |
| 57 // Weak ptr to delegate. |
| 58 ConstrainedWebDialogDelegate* delegate_; |
| 59 |
| 60 // The GAIA username being signed in. |
| 61 std::string username_; |
| 62 |
| 63 // Dialog button callbacks. |
| 64 base::Closure cancel_signin_; |
| 65 base::Closure signin_with_new_profile_; |
| 66 base::Closure continue_signin_; |
| 67 |
| 68 // Cleanup bookkeeping. Labeled mutable to get around inherited const |
| 69 // label on GetWebUIMessageHandlers. |
| 70 mutable bool closed_by_handler_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); |
| 73 }; |
| 74 |
| 75 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
OLD | NEW |