profile_signin_confirmation_dialog_views.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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/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" 15 16class Browser; 17class Profile; 18 19namespace content { 20class WebContents; 21} 22 23namespace views { 24class StyledLabel; 25} 26 27// A tab-modal dialog to allow a user signing in with a managed account 28// to create a new Chrome profile. 29class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView, 30 public views::StyledLabelListener, 31 public views::ButtonListener { 32 public: 33 // Create and show the dialog, which owns itself. 34 static void ShowDialog(Browser* browser, 35 Profile* profile, 36 const std::string& username, 37 ui::ProfileSigninConfirmationDelegate* delegate); 38 39 private: 40 ProfileSigninConfirmationDialogViews( 41 Browser* browser, 42 Profile* profile, 43 const std::string& username, 44 ui::ProfileSigninConfirmationDelegate* delegate); 45 virtual ~ProfileSigninConfirmationDialogViews(); 46 47 // views::DialogDelegateView: 48 virtual base::string16 GetWindowTitle() const OVERRIDE; 49 virtual base::string16 GetDialogButtonLabel( 50 ui::DialogButton button) const OVERRIDE; 51 virtual int GetDefaultDialogButton() const OVERRIDE; 52 virtual views::View* CreateExtraView() OVERRIDE; 53 virtual bool Accept() OVERRIDE; 54 virtual bool Cancel() OVERRIDE; 55 virtual void OnClosed() OVERRIDE; 56 virtual ui::ModalType GetModalType() const OVERRIDE; 57 virtual void ViewHierarchyChanged( 58 const ViewHierarchyChangedDetails& details) OVERRIDE; 59 60 // views::StyledLabelListener: 61 virtual void StyledLabelLinkClicked(const gfx::Range& range, 62 int event_flags) OVERRIDE; 63 64 // views::ButtonListener: 65 virtual void ButtonPressed(views::Button*, const ui::Event& event) OVERRIDE; 66 67 // Shows the dialog and releases ownership of this object. It will 68 // delete itself when the dialog is closed. If |prompt_for_new_profile| 69 // is true, the dialog will offer to create a new profile before signin. 70 void Show(bool prompt_for_new_profile); 71 72 // Weak ptr to label for dialog explanation text. 73 views::StyledLabel* explanation_label_; 74 75 // Weak ptr to parent view. 76 Browser* browser_; 77 78 // The profile being signed in. 79 Profile* profile_; 80 81 // The GAIA username being signed in. 82 std::string username_; 83 84 // Dialog button handler. 85 ui::ProfileSigninConfirmationDelegate* delegate_; 86 87 // Whether the user should be prompted to create a new profile. 88 bool prompt_for_new_profile_; 89 90 // The button to continue with signin, if an extra button is required. 91 views::LabelButton* continue_signin_button_; 92 93 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews); 94}; 95 96#endif // CHROME_BROWSER_UI_VIEWS_SYNC_PROFILE_SIGNIN_CONFIRMATION_DIALOG_VIEWS_H_ 97