Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / signin / profile_signin_confirmation_dialog.h
blobcada63e2b88571adaf9c29cb0fab9121bc30088b
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
12 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
14 #include "components/history/core/browser/history_types.h"
15 #include "ui/base/ui_base_types.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h"
18 class Browser;
19 class Profile;
20 class WebUIMessageHandler;
22 namespace content {
23 class WebContents;
26 // A tab-modal dialog to allow a user signing in with a managed account
27 // to create a new Chrome profile.
28 class ProfileSigninConfirmationDialog : public ui::WebDialogDelegate {
29 public:
30 // Create and show the dialog, which owns itself.
31 static void ShowDialog(
32 content::WebContents* web_contents,
33 Profile* profile,
34 const std::string& username,
35 ui::ProfileSigninConfirmationDelegate* delegate);
37 // Closes the dialog, which will delete itself.
38 void Close() const;
40 private:
41 ProfileSigninConfirmationDialog(
42 content::WebContents* web_contents,
43 Profile* profile,
44 const std::string& username,
45 ui::ProfileSigninConfirmationDelegate* delegate);
46 ~ProfileSigninConfirmationDialog() override;
48 // Shows the dialog and releases ownership of this object. It will
49 // delete itself when the dialog is closed. If |prompt_for_new_profile|
50 // is true, the dialog will offer to create a new profile before signin.
51 void Show(bool prompt_for_new_profile);
53 // WebDialogDelegate implementation.
54 ui::ModalType GetDialogModalType() const override;
55 base::string16 GetDialogTitle() const override;
56 GURL GetDialogContentURL() const override;
57 void GetWebUIMessageHandlers(
58 std::vector<content::WebUIMessageHandler*>* handlers) const override;
59 void GetDialogSize(gfx::Size* size) const override;
60 std::string GetDialogArgs() const override;
61 void OnDialogClosed(const std::string& json_retval) override;
62 void OnCloseContents(content::WebContents* source,
63 bool* out_close_dialog) override;
64 bool ShouldShowDialogTitle() const override;
66 // Weak pointer to the containing view.
67 content::WebContents* web_contents_;
69 // Weak pointer to the profile being signed-in.
70 Profile* profile_;
72 // The GAIA username being signed in.
73 std::string username_;
75 // Weak pointer to the signin delegate.
76 ui::ProfileSigninConfirmationDelegate* signin_delegate_;
78 // Weak pointer to the dialog delegate.
79 ConstrainedWebDialogDelegate* dialog_delegate_;
81 // Whether to show the "Create a new profile" button.
82 bool prompt_for_new_profile_;
84 // Cleanup bookkeeping. Labeled mutable to get around inherited const
85 // label on GetWebUIMessageHandlers.
86 mutable bool closed_by_handler_;
88 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialog);
91 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_SIGNIN_CONFIRMATION_DIALOG_H_