Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h

Issue 14846020: Add Views implementation of ProfileSigninConfirmationDialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nits Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/string16.h" 11 #include "base/string16.h"
13 #include "chrome/browser/common/cancelable_request.h" 12 #include "chrome/browser/common/cancelable_request.h"
14 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
15 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 15 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
16 #include "ui/base/ui_base_types.h" 16 #include "ui/base/ui_base_types.h"
17 #include "ui/web_dialogs/web_dialog_delegate.h" 17 #include "ui/web_dialogs/web_dialog_delegate.h"
18 18
19 class Browser;
19 class Profile; 20 class Profile;
20 class WebUIMessageHandler; 21 class WebUIMessageHandler;
21 22
23 namespace content {
24 class WebContents;
25 }
26
22 // A tab-modal dialog to allow a user signing in with a managed account 27 // A tab-modal dialog to allow a user signing in with a managed account
23 // to create a new Chrome profile. 28 // to create a new Chrome profile.
24 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { 29 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate {
25 public: 30 public:
26 // Creates and shows the modal dialog. |profile| is the current Chrome 31 // Create and show the dialog, which owns itself.
27 // profile and |username| is the GAIA username that the user is signing 32 static void ShowDialog(
28 // in with. 33 content::WebContents* web_contents,
29 static void ShowDialog(Profile* profile, 34 Profile* profile,
30 const std::string& username, 35 const std::string& username,
31 const base::Closure& cancel_signin, 36 const base::Closure& cancel_signin,
32 const base::Closure& signin_with_new_profile, 37 const base::Closure& signin_with_new_profile,
33 const base::Closure& continue_signin); 38 const base::Closure& continue_signin);
34 39
35 // Closes the dialog, which will delete itself. 40 // Closes the dialog, which will delete itself.
36 void Close() const; 41 void Close() const;
37 42
38 private: 43 private:
39 ProfileSigninConfirmationDialog( 44 ProfileSigninConfirmationDialog(
45 content::WebContents* web_contents,
40 Profile* profile, 46 Profile* profile,
41 const std::string& username, 47 const std::string& username,
42 const base::Closure& cancel_signin, 48 const base::Closure& cancel_signin,
43 const base::Closure& signin_with_new_profile, 49 const base::Closure& signin_with_new_profile,
44 const base::Closure& continue_signin); 50 const base::Closure& continue_signin);
45 virtual ~ProfileSigninConfirmationDialog(); 51 virtual ~ProfileSigninConfirmationDialog();
46 52
47 // Shows the dialog and releases ownership of this object. It will 53 // Shows the dialog and releases ownership of this object. It will
48 // delete itself when the dialog is closed. If |prompt_for_new_profile| 54 // delete itself when the dialog is closed. If |prompt_for_new_profile|
49 // is true, the dialog will offer to create a new profile before signin. 55 // is true, the dialog will offer to create a new profile before signin.
50 void Show(bool prompt_for_new_profile); 56 void Show(bool prompt_for_new_profile);
51 57
52 // WebDialogDelegate implementation. 58 // WebDialogDelegate implementation.
53 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 59 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
54 virtual string16 GetDialogTitle() const OVERRIDE; 60 virtual string16 GetDialogTitle() const OVERRIDE;
55 virtual GURL GetDialogContentURL() const OVERRIDE; 61 virtual GURL GetDialogContentURL() const OVERRIDE;
56 virtual void GetWebUIMessageHandlers( 62 virtual void GetWebUIMessageHandlers(
57 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; 63 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
58 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 64 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
59 virtual std::string GetDialogArgs() const OVERRIDE; 65 virtual std::string GetDialogArgs() const OVERRIDE;
60 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 66 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
61 virtual void OnCloseContents(content::WebContents* source, 67 virtual void OnCloseContents(content::WebContents* source,
62 bool* out_close_dialog) OVERRIDE; 68 bool* out_close_dialog) OVERRIDE;
63 virtual bool ShouldShowDialogTitle() const OVERRIDE; 69 virtual bool ShouldShowDialogTitle() const OVERRIDE;
64 70
65 // Weak ptr to delegate. 71 // Weak pointer to the containing view.
66 ConstrainedWebDialogDelegate* delegate_; 72 content::WebContents* web_contents_;
73
74 // Weak pointer to the profile being signed-in.
75 Profile* profile_;
67 76
68 // The GAIA username being signed in. 77 // The GAIA username being signed in.
69 std::string username_; 78 std::string username_;
70 79
71 // Whether to show the "Create a new profile" button.
72 bool prompt_for_new_profile_;
73
74 // Dialog button callbacks. 80 // Dialog button callbacks.
75 base::Closure cancel_signin_; 81 base::Closure cancel_signin_;
76 base::Closure signin_with_new_profile_; 82 base::Closure signin_with_new_profile_;
77 base::Closure continue_signin_; 83 base::Closure continue_signin_;
78 84
79 // Weak pointer to the profile being signed-in. 85 // Weak pointer to the delegate.
80 Profile* profile_; 86 ConstrainedWebDialogDelegate* delegate_;
87
88 // Whether to show the "Create a new profile" button.
89 bool prompt_for_new_profile_;
81 90
82 // Cleanup bookkeeping. Labeled mutable to get around inherited const 91 // Cleanup bookkeeping. Labeled mutable to get around inherited const
83 // label on GetWebUIMessageHandlers. 92 // label on GetWebUIMessageHandlers.
84 mutable bool closed_by_handler_; 93 mutable bool closed_by_handler_;
85 94
86 base::WeakPtrFactory<ProfileSigninConfirmationDialog> weak_pointer_factory_;
87
88 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); 95 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog);
89 }; 96 };
90 97
91 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ 98 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698