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

Side by Side Diff: chrome/browser/ui/webui/managed_user_passphrase_dialog.h

Issue 12218118: Add a passphrase dialog for managed user accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments and rebase to ToT. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
6 #define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
7
8 #if !(defined(USE_AURA) || defined(OS_CHROMEOS))
9 #error Tab-modal confirm dialog should be shown with native UI.
10 #endif
11 7
12 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h"
13 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h" 11 #include "ui/web_dialogs/web_dialog_delegate.h"
17 12
18 class ConstrainedWebDialogDelegate; 13 class ConstrainedWebDialogDelegate;
14 class Profile;
19 15
20 namespace content { 16 namespace content {
21 class WebContents; 17 class WebContents;
22 } 18 }
23 19
20 namespace base {
21 class Value;
22 }
23
24 // Called on the UI thread after the Passphrase Dialog was closed. A boolean
25 // flag is passed which indicates if the authentication was successful or not.
26 typedef base::Callback<void(bool)> PassphraseCheckedCallback;
27
24 // Displays a tab-modal dialog, i.e. a dialog that will block the current page 28 // Displays a tab-modal dialog, i.e. a dialog that will block the current page
25 // but still allow the user to switch to a different page. 29 // but still allow the user to switch to a different page.
26 // To display the dialog, allocate this object on the heap. It will open the 30 // To display the dialog, allocate this object on the heap. It will open the
27 // dialog from its constructor and then delete itself when the user dismisses 31 // dialog from its constructor and then delete itself when the user dismisses
28 // the dialog. 32 // the dialog.
29 class TabModalConfirmDialogWebUI : public TabModalConfirmDialog, 33 class ManagedUserPassphraseDialog : public ui::WebDialogDelegate {
30 public ui::WebDialogDelegate {
31 public: 34 public:
32 TabModalConfirmDialogWebUI( 35 // Creates a passphrase dialog which will be deleted automatically when the
33 TabModalConfirmDialogDelegate* dialog_delegate, 36 // user closes the dialog.
34 content::WebContents* web_contents); 37 ManagedUserPassphraseDialog(content::WebContents* web_contents,
38 const PassphraseCheckedCallback& callback);
35 39
36 // ui::WebDialogDelegate implementation. 40 // ui::WebDialogDelegate implementation.
37 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 41 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
38 virtual string16 GetDialogTitle() const OVERRIDE; 42 virtual string16 GetDialogTitle() const OVERRIDE;
39 virtual GURL GetDialogContentURL() const OVERRIDE; 43 virtual GURL GetDialogContentURL() const OVERRIDE;
40 virtual void GetWebUIMessageHandlers( 44 virtual void GetWebUIMessageHandlers(
41 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; 45 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
42 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 46 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
43 virtual std::string GetDialogArgs() const OVERRIDE; 47 virtual std::string GetDialogArgs() const OVERRIDE;
44 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 48 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
45 virtual void OnCloseContents(content::WebContents* source, 49 virtual void OnCloseContents(content::WebContents* source,
46 bool* out_close_dialog) OVERRIDE; 50 bool* out_close_dialog) OVERRIDE;
47 virtual bool ShouldShowDialogTitle() const OVERRIDE; 51 virtual bool ShouldShowDialogTitle() const OVERRIDE;
48 52
49 ConstrainedWebDialogDelegate* constrained_web_dialog_delegate() { 53 private:
50 return constrained_web_dialog_delegate_; 54 virtual ~ManagedUserPassphraseDialog();
51 }
52 55
53 private: 56 // Creates and initializes the WebUIDataSource which is used for this dialog.
54 virtual ~TabModalConfirmDialogWebUI(); 57 void CreateDataSource(Profile* profile) const;
55 58
56 // TabModalConfirmDialog: 59 PassphraseCheckedCallback callback_;
57 virtual void AcceptTabModalDialog() OVERRIDE;
58 virtual void CancelTabModalDialog() OVERRIDE;
59 60
60 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; 61 DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphraseDialog);
61
62 // Deletes itself.
63 ConstrainedWebDialogDelegate* constrained_web_dialog_delegate_;
64
65 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI);
66 }; 62 };
67 63
68 #endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ 64 #endif // CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698