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

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: no forward declared enums Created 7 years, 7 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
27 namespace chrome {
28 void ShowProfileSigninConfirmationDialog(
Peter Kasting 2013/05/15 00:11:03 Why do we have this declaration both here and in b
dconnelly 2013/05/17 13:01:55 It's declared in browser_dialogs.h. It's re-decla
Peter Kasting 2013/05/17 18:45:53 The #include should not have been removed, but thi
29 Browser* browser, content::WebContents* web_contents,
Peter Kasting 2013/05/15 00:11:03 Nit: While this wrapping style is legal, I think p
dconnelly 2013/05/17 13:01:55 Done.
30 Profile*, const std::string&,
31 const base::Closure&, const base::Closure&, const base::Closure&);
32 }
33
22 // A tab-modal dialog to allow a user signing in with a managed account 34 // A tab-modal dialog to allow a user signing in with a managed account
23 // to create a new Chrome profile. 35 // to create a new Chrome profile.
24 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { 36 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate {
25 public: 37 public:
26 // Creates and shows the modal dialog. |profile| is the current Chrome
27 // profile and |username| is the GAIA username that the user is signing
28 // in with.
29 static void ShowDialog(Profile* profile,
30 const std::string& username,
31 const base::Closure& cancel_signin,
32 const base::Closure& signin_with_new_profile,
33 const base::Closure& continue_signin);
34
35 // Closes the dialog, which will delete itself. 38 // Closes the dialog, which will delete itself.
36 void Close() const; 39 void Close() const;
37 40
38 private: 41 private:
42 friend void ::chrome::ShowProfileSigninConfirmationDialog(
Peter Kasting 2013/05/15 00:11:03 Nit: It seems like we could avoid the need for thi
dconnelly 2013/05/17 13:01:55 Here's the idea: there is one top-level function (
Peter Kasting 2013/05/17 18:45:53 I'm OK with this.
43 Browser* browser, content::WebContents* web_contents,
44 Profile*, const std::string&,
45 const base::Closure&, const base::Closure&, const base::Closure&);
46
39 ProfileSigninConfirmationDialog( 47 ProfileSigninConfirmationDialog(
48 content::WebContents* web_contents,
40 Profile* profile, 49 Profile* profile,
41 const std::string& username, 50 const std::string& username,
42 const base::Closure& cancel_signin, 51 const base::Closure& cancel_signin,
43 const base::Closure& signin_with_new_profile, 52 const base::Closure& signin_with_new_profile,
44 const base::Closure& continue_signin); 53 const base::Closure& continue_signin);
45 virtual ~ProfileSigninConfirmationDialog(); 54 virtual ~ProfileSigninConfirmationDialog();
46 55
47 // Shows the dialog and releases ownership of this object. It will 56 // Shows the dialog and releases ownership of this object. It will
48 // delete itself when the dialog is closed. If |prompt_for_new_profile| 57 // 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. 58 // is true, the dialog will offer to create a new profile before signin.
50 void Show(bool prompt_for_new_profile); 59 void Show(ui::DisplayCreateProfilePrompt prompt_for_new_profile);
51 60
52 // WebDialogDelegate implementation. 61 // WebDialogDelegate implementation.
53 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 62 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
54 virtual string16 GetDialogTitle() const OVERRIDE; 63 virtual string16 GetDialogTitle() const OVERRIDE;
55 virtual GURL GetDialogContentURL() const OVERRIDE; 64 virtual GURL GetDialogContentURL() const OVERRIDE;
56 virtual void GetWebUIMessageHandlers( 65 virtual void GetWebUIMessageHandlers(
57 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; 66 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
58 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 67 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
59 virtual std::string GetDialogArgs() const OVERRIDE; 68 virtual std::string GetDialogArgs() const OVERRIDE;
60 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 69 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
61 virtual void OnCloseContents(content::WebContents* source, 70 virtual void OnCloseContents(content::WebContents* source,
62 bool* out_close_dialog) OVERRIDE; 71 bool* out_close_dialog) OVERRIDE;
63 virtual bool ShouldShowDialogTitle() const OVERRIDE; 72 virtual bool ShouldShowDialogTitle() const OVERRIDE;
64 73
74 // The containing view.
75 content::WebContents* web_contents_;
76
65 // Weak ptr to delegate. 77 // Weak ptr to delegate.
66 ConstrainedWebDialogDelegate* delegate_; 78 ConstrainedWebDialogDelegate* delegate_;
67 79
68 // The GAIA username being signed in. 80 // The GAIA username being signed in.
69 std::string username_; 81 std::string username_;
70 82
71 // Whether to show the "Create a new profile" button. 83 // Whether to show the "Create a new profile" button.
72 bool prompt_for_new_profile_; 84 ui::DisplayCreateProfilePrompt prompt_for_new_profile_;
73 85
74 // Dialog button callbacks. 86 // Dialog button callbacks.
75 base::Closure cancel_signin_; 87 base::Closure cancel_signin_;
76 base::Closure signin_with_new_profile_; 88 base::Closure signin_with_new_profile_;
77 base::Closure continue_signin_; 89 base::Closure continue_signin_;
78 90
79 // Weak pointer to the profile being signed-in. 91 // Weak pointer to the profile being signed-in.
80 Profile* profile_; 92 Profile* profile_;
81 93
82 // Cleanup bookkeeping. Labeled mutable to get around inherited const 94 // Cleanup bookkeeping. Labeled mutable to get around inherited const
83 // label on GetWebUIMessageHandlers. 95 // label on GetWebUIMessageHandlers.
84 mutable bool closed_by_handler_; 96 mutable bool closed_by_handler_;
85 97
86 base::WeakPtrFactory<ProfileSigninConfirmationDialog> weak_pointer_factory_;
87
88 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); 98 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog);
89 }; 99 };
90 100
91 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ 101 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698