Chromium Code Reviews| Index: chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h |
| diff --git a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..494a51ec986fa9ab46a945f2739fbfb2173337d3 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/string16.h" |
| +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| +#include "ui/base/ui_base_types.h" |
| +#include "ui/web_dialogs/web_dialog_delegate.h" |
| + |
| +class Profile; |
| +class WebUIMessageHandler; |
| + |
| +// A tab-modal dialog to allow a user signing in with a managed account |
| +// to create a new Chrome profile. |
| +class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate { |
| + public: |
| + // Create and show the modal dialog. |profile| is the current Chrome |
|
James Hawkins
2013/02/12 21:40:40
nit: Creates and shows
dconnelly
2013/02/13 09:02:27
Done.
|
| + // profile and |username| is the GAIA username that the user is signing |
| + // in with. |
| + static void ShowDialog(Profile* profile, |
| + const std::string& username, |
| + const base::Closure& cancel_signin, |
| + const base::Closure& signin_with_new_profile, |
| + const base::Closure& continue_signin); |
| + |
| + // Programmatically lose the dialog, which will delete itself. |
|
James Hawkins
2013/02/12 21:40:40
nit: Not sure what you mean by 'lose' here, and th
dconnelly
2013/02/13 09:02:27
Done.
|
| + void Close() const; |
| + |
| + private: |
| + ProfileSigninConfirmationDialog( |
| + Profile* profile, |
| + const std::string& username, |
| + const base::Closure& cancel_signin, |
| + const base::Closure& signin_with_new_profile, |
| + const base::Closure& continue_signin); |
| + virtual ~ProfileSigninConfirmationDialog(); |
| + |
| + // Overridden from WebDialogDelegate: |
|
James Hawkins
2013/02/12 21:40:40
// WebDialogDelegate implementation.
dconnelly
2013/02/13 09:02:27
Done.
|
| + virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
| + virtual string16 GetDialogTitle() const OVERRIDE; |
| + virtual GURL GetDialogContentURL() const OVERRIDE; |
| + virtual void GetWebUIMessageHandlers( |
| + std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| + virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| + virtual std::string GetDialogArgs() const OVERRIDE; |
| + virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| + virtual void OnCloseContents(content::WebContents* source, |
| + bool* out_close_dialog) OVERRIDE; |
| + virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| + |
| + // Weak ptr to delegate. |
| + ConstrainedWebDialogDelegate* delegate_; |
| + |
| + std::string username_; |
|
James Hawkins
2013/02/12 21:40:40
nit: Document member variables.
dconnelly
2013/02/13 09:02:27
Done.
|
| + base::Closure cancel_signin_; |
| + base::Closure signin_with_new_profile_; |
| + base::Closure continue_signin_; |
| + |
| + // Cleanup bookkeeping. Labeled mutable to get around inherited const |
| + // label on GetWebUIMessageHandlers. |
| + mutable bool closed_by_handler_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_ |