| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "ui/web_dialogs/web_dialog_delegate.h" | |
| 12 | |
| 13 class ConstrainedWebDialogDelegate; | |
| 14 class Profile; | |
| 15 | |
| 16 namespace content { | |
| 17 class WebContents; | |
| 18 } | |
| 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 | |
| 28 // Displays a tab-modal dialog, i.e. a dialog that will block the current page | |
| 29 // but still allow the user to switch to a different page. | |
| 30 // To display the dialog, allocate this object on the heap. It will open the | |
| 31 // dialog from its constructor and then delete itself when the user dismisses | |
| 32 // the dialog. | |
| 33 class ManagedUserPassphraseDialog : public ui::WebDialogDelegate { | |
| 34 public: | |
| 35 // Creates a passphrase dialog which will be deleted automatically when the | |
| 36 // user closes the dialog. | |
| 37 ManagedUserPassphraseDialog(content::WebContents* web_contents, | |
| 38 const PassphraseCheckedCallback& callback); | |
| 39 | |
| 40 // ui::WebDialogDelegate implementation. | |
| 41 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | |
| 42 virtual string16 GetDialogTitle() const OVERRIDE; | |
| 43 virtual GURL GetDialogContentURL() const OVERRIDE; | |
| 44 virtual void GetWebUIMessageHandlers( | |
| 45 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | |
| 46 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | |
| 47 virtual std::string GetDialogArgs() const OVERRIDE; | |
| 48 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | |
| 49 virtual void OnCloseContents(content::WebContents* source, | |
| 50 bool* out_close_dialog) OVERRIDE; | |
| 51 virtual bool ShouldShowDialogTitle() const OVERRIDE; | |
| 52 | |
| 53 private: | |
| 54 virtual ~ManagedUserPassphraseDialog(); | |
| 55 | |
| 56 // Creates and initializes the WebUIDataSource which is used for this dialog. | |
| 57 void CreateDataSource(Profile* profile) const; | |
| 58 | |
| 59 PassphraseCheckedCallback callback_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphraseDialog); | |
| 62 }; | |
| 63 | |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ | |
| OLD | NEW |