| OLD | NEW |
| (Empty) | |
| 1 // Copyright 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_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
| 11 #include "ui/views/controls/link_listener.h" |
| 12 #include "ui/views/controls/styled_label_listener.h" |
| 13 #include "ui/views/window/dialog_delegate.h" |
| 14 |
| 15 class Browser; |
| 16 class Profile; |
| 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
| 22 namespace views { |
| 23 class StyledLabel; |
| 24 } |
| 25 |
| 26 // A tab-modal dialog to allow a user signing in with a managed account |
| 27 // to create a new Chrome profile. |
| 28 class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView, |
| 29 public views::LinkListener, |
| 30 public views::StyledLabelListener { |
| 31 public: |
| 32 // Create and show the dialog, which owns itself. |
| 33 static void ShowDialog(Browser* browser, |
| 34 Profile* profile, |
| 35 const std::string& username, |
| 36 const base::Closure& cancel_signin, |
| 37 const base::Closure& signin_with_new_profile, |
| 38 const base::Closure& continue_signin); |
| 39 |
| 40 private: |
| 41 ProfileSigninConfirmationDialogViews( |
| 42 Browser* browser, |
| 43 Profile* profile, |
| 44 const std::string& username, |
| 45 const base::Closure& cancel_signin, |
| 46 const base::Closure& signin_with_new_profile, |
| 47 const base::Closure& continue_signin); |
| 48 virtual ~ProfileSigninConfirmationDialogViews(); |
| 49 |
| 50 // views::DialogDelegateView: |
| 51 virtual string16 GetWindowTitle() const OVERRIDE; |
| 52 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 53 virtual int GetDefaultDialogButton() const OVERRIDE; |
| 54 virtual views::View* CreateExtraView() OVERRIDE; |
| 55 virtual bool Accept() OVERRIDE; |
| 56 virtual bool Cancel() OVERRIDE; |
| 57 virtual void OnClose() OVERRIDE; |
| 58 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 59 virtual void ViewHierarchyChanged( |
| 60 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 61 |
| 62 // views::LinkListener: |
| 63 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 64 |
| 65 // views::StyledLabelListener: |
| 66 virtual void StyledLabelLinkClicked(const ui::Range& range, |
| 67 int event_flags) OVERRIDE; |
| 68 |
| 69 // Shows the dialog and releases ownership of this object. It will |
| 70 // delete itself when the dialog is closed. If |prompt_for_new_profile| |
| 71 // is true, the dialog will offer to create a new profile before signin. |
| 72 void Show(bool prompt_for_new_profile); |
| 73 |
| 74 // Resets all the user response handling callbacks. |
| 75 void ResetCallbacks(); |
| 76 |
| 77 // Weak ptr to label for dialog explanation text. |
| 78 views::StyledLabel* explanation_label_; |
| 79 |
| 80 // Weak ptr to parent view. |
| 81 Browser* browser_; |
| 82 |
| 83 // The profile being signed in. |
| 84 Profile* profile_; |
| 85 |
| 86 // The GAIA username being signed in. |
| 87 std::string username_; |
| 88 |
| 89 // Dialog button callbacks. |
| 90 base::Closure cancel_signin_; |
| 91 base::Closure signin_with_new_profile_; |
| 92 base::Closure continue_signin_; |
| 93 |
| 94 // Whether the user should be prompted to create a new profile. |
| 95 bool prompt_for_new_profile_; |
| 96 |
| 97 // The link to create a new profile. |
| 98 views::Link* link_; |
| 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews); |
| 101 }; |
| 102 |
| 103 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS
_H_ |
| OLD | NEW |