Chromium Code Reviews| 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::DialogDelegate: | |
|
Peter Kasting
2013/05/28 23:25:11
Tiny nit: You don't actually inherit directly from
dconnelly
2013/05/29 16:46:14
Done.
| |
| 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 | |
| 60 // views::View: | |
| 61 virtual void ViewHierarchyChanged( | |
| 62 const ViewHierarchyChangedDetails& details) OVERRIDE; | |
| 63 | |
| 64 // views::LinkListener: | |
| 65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
| 66 | |
| 67 // views::StyledLabelListener: | |
| 68 virtual void StyledLabelLinkClicked(const ui::Range& range, | |
| 69 int event_flags) OVERRIDE; | |
| 70 | |
| 71 // Create and add all child views. | |
| 72 void Init(); | |
|
Peter Kasting
2013/05/28 23:25:11
Nit: Personally, I don't think this adds much to j
dconnelly
2013/05/29 16:46:14
Done.
| |
| 73 | |
| 74 // Shows the dialog and releases ownership of this object. It will | |
| 75 // delete itself when the dialog is closed. If |prompt_for_new_profile| | |
| 76 // is true, the dialog will offer to create a new profile before signin. | |
| 77 void Show(bool prompt_for_new_profile); | |
| 78 | |
| 79 // Resets all the user response handling callbacks. | |
| 80 void ResetCallbacks(); | |
| 81 | |
| 82 // Weak ptr to label for dialog explanation text. | |
| 83 views::StyledLabel* explanation_label_; | |
| 84 | |
| 85 // Weak ptr to parent view. | |
| 86 Browser* browser_; | |
| 87 | |
| 88 // The profile being signed in. | |
| 89 Profile* profile_; | |
| 90 | |
| 91 // The GAIA username being signed in. | |
| 92 std::string username_; | |
| 93 | |
| 94 // Dialog button callbacks. | |
| 95 base::Closure cancel_signin_; | |
| 96 base::Closure signin_with_new_profile_; | |
| 97 base::Closure continue_signin_; | |
| 98 | |
| 99 // Whether the user should be prompted to create a new profile. | |
| 100 bool prompt_for_new_profile_; | |
| 101 | |
| 102 // The link to create a new profile. | |
| 103 views::Link* link_; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews); | |
| 106 }; | |
| 107 | |
| 108 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS _H_ | |
| OLD | NEW |