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.
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_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/button/label_button.h"
12 #include "ui/views/controls/link_listener.h"
13 #include "ui/views/controls/styled_label_listener.h"
14 #include "ui/views/window/dialog_delegate.h"
27 // A tab-modal dialog to allow a user signing in with a managed account
28 // to create a new Chrome profile.
29 class ProfileSigninConfirmationDialogViews
: public views::DialogDelegateView
,
30 public views::StyledLabelListener
,
31 public views::ButtonListener
{
33 // Create and show the dialog, which owns itself.
34 static void ShowDialog(Browser
* browser
,
36 const std::string
& username
,
37 ui::ProfileSigninConfirmationDelegate
* delegate
);
40 ProfileSigninConfirmationDialogViews(
42 const std::string
& username
,
43 ui::ProfileSigninConfirmationDelegate
* delegate
);
44 ~ProfileSigninConfirmationDialogViews() override
;
46 // views::DialogDelegateView:
47 base::string16
GetWindowTitle() const override
;
48 base::string16
GetDialogButtonLabel(ui::DialogButton button
) const override
;
49 int GetDefaultDialogButton() const override
;
50 views::View
* CreateExtraView() override
;
51 bool Accept() override
;
52 bool Cancel() override
;
53 void OnClosed() override
;
54 ui::ModalType
GetModalType() const override
;
55 void ViewHierarchyChanged(
56 const ViewHierarchyChangedDetails
& details
) override
;
58 // views::StyledLabelListener:
59 void StyledLabelLinkClicked(const gfx::Range
& range
,
60 int event_flags
) override
;
62 // views::ButtonListener:
63 void ButtonPressed(views::Button
*, const ui::Event
& event
) override
;
65 // Shows the dialog and releases ownership of this object. It will
66 // delete itself when the dialog is closed. If |prompt_for_new_profile|
67 // is true, the dialog will offer to create a new profile before signin.
68 void Show(bool prompt_for_new_profile
);
70 // Weak ptr to label for dialog explanation text.
71 views::StyledLabel
* explanation_label_
;
73 // Weak ptr to parent view.
76 // The GAIA username being signed in.
77 std::string username_
;
79 // Dialog button handler.
80 ui::ProfileSigninConfirmationDelegate
* delegate_
;
82 // Whether the user should be prompted to create a new profile.
83 bool prompt_for_new_profile_
;
85 // The button to continue with signin, if an extra button is required.
86 views::LabelButton
* continue_signin_button_
;
88 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews
);
91 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS_H_