Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser_dialogs.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 Profile; | 19 class Profile; |
| 20 class WebUIMessageHandler; | 20 class WebUIMessageHandler; |
| 21 | 21 |
| 22 // A tab-modal dialog to allow a user signing in with a managed account | 22 // A tab-modal dialog to allow a user signing in with a managed account |
| 23 // to create a new Chrome profile. | 23 // to create a new Chrome profile. |
| 24 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { | 24 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { |
| 25 public: | 25 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. | 26 // Closes the dialog, which will delete itself. |
| 36 void Close() const; | 27 void Close() const; |
| 37 | 28 |
| 38 private: | 29 private: |
| 30 friend void chrome::ShowProfileSigninConfirmationDialog( | |
|
James Hawkins
2013/05/07 17:22:44
Why is this necessary?
dconnelly
2013/05/07 17:31:30
This class has a private constructor and destructo
| |
| 31 Profile*, const std::string&, | |
| 32 const base::Closure&, const base::Closure&, const base::Closure&); | |
| 33 | |
| 39 ProfileSigninConfirmationDialog( | 34 ProfileSigninConfirmationDialog( |
| 40 Profile* profile, | 35 Profile* profile, |
| 41 const std::string& username, | 36 const std::string& username, |
| 42 const base::Closure& cancel_signin, | 37 const base::Closure& cancel_signin, |
| 43 const base::Closure& signin_with_new_profile, | 38 const base::Closure& signin_with_new_profile, |
| 44 const base::Closure& continue_signin); | 39 const base::Closure& continue_signin); |
| 45 virtual ~ProfileSigninConfirmationDialog(); | 40 virtual ~ProfileSigninConfirmationDialog(); |
| 46 | 41 |
| 47 // Shows the dialog and releases ownership of this object. It will | 42 // Shows the dialog and releases ownership of this object. It will |
| 48 // delete itself when the dialog is closed. If |prompt_for_new_profile| | 43 // delete itself when the dialog is closed. If |prompt_for_new_profile| |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 76 base::Closure signin_with_new_profile_; | 71 base::Closure signin_with_new_profile_; |
| 77 base::Closure continue_signin_; | 72 base::Closure continue_signin_; |
| 78 | 73 |
| 79 // Weak pointer to the profile being signed-in. | 74 // Weak pointer to the profile being signed-in. |
| 80 Profile* profile_; | 75 Profile* profile_; |
| 81 | 76 |
| 82 // Cleanup bookkeeping. Labeled mutable to get around inherited const | 77 // Cleanup bookkeeping. Labeled mutable to get around inherited const |
| 83 // label on GetWebUIMessageHandlers. | 78 // label on GetWebUIMessageHandlers. |
| 84 mutable bool closed_by_handler_; | 79 mutable bool closed_by_handler_; |
| 85 | 80 |
| 86 base::WeakPtrFactory<ProfileSigninConfirmationDialog> weak_pointer_factory_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); | 81 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); |
| 89 }; | 82 }; |
| 90 | 83 |
| 91 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ | 84 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
| OLD | NEW |