Index: chrome/browser/ui/webui/managed_user_passphrase_dialog.h |
diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h b/chrome/browser/ui/webui/managed_user_passphrase_dialog.h |
similarity index 52% |
copy from chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h |
copy to chrome/browser/ui/webui/managed_user_passphrase_dialog.h |
index 06266403d4e691b967c43a3b5955b495e868e8e8..5b0c7f07f4d81358d9fbcf75f2109f228b94f6ce 100644 |
--- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h |
+++ b/chrome/browser/ui/webui/managed_user_passphrase_dialog.h |
@@ -1,37 +1,41 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// 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_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
-#define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
- |
-#if !(defined(USE_AURA) || defined(OS_CHROMEOS)) |
-#error Tab-modal confirm dialog should be shown with native UI. |
-#endif |
+#ifndef CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ |
+#define CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/compiler_specific.h" |
-#include "base/memory/scoped_ptr.h" |
-#include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
#include "ui/web_dialogs/web_dialog_delegate.h" |
class ConstrainedWebDialogDelegate; |
+class Profile; |
namespace content { |
class WebContents; |
} |
+namespace base { |
+class Value; |
+} |
+ |
+// Called on the UI thread after the Passphrase Dialog was closed. A boolean |
+// flag is passed which indicates if the authentication was successful or not. |
+typedef base::Callback<void(bool)> PassphraseCheckedCallback; |
+ |
// Displays a tab-modal dialog, i.e. a dialog that will block the current page |
// but still allow the user to switch to a different page. |
// To display the dialog, allocate this object on the heap. It will open the |
// dialog from its constructor and then delete itself when the user dismisses |
// the dialog. |
-class TabModalConfirmDialogWebUI : public TabModalConfirmDialog, |
- public ui::WebDialogDelegate { |
+class ManagedUserPassphraseDialog : public ui::WebDialogDelegate { |
public: |
- TabModalConfirmDialogWebUI( |
- TabModalConfirmDialogDelegate* dialog_delegate, |
- content::WebContents* web_contents); |
+ // Creates a passphrase dialog which will be deleted automatically when the |
+ // user closes the dialog. |
+ ManagedUserPassphraseDialog(content::WebContents* web_contents, |
+ const PassphraseCheckedCallback& callback); |
// ui::WebDialogDelegate implementation. |
virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
@@ -46,23 +50,15 @@ class TabModalConfirmDialogWebUI : public TabModalConfirmDialog, |
bool* out_close_dialog) OVERRIDE; |
virtual bool ShouldShowDialogTitle() const OVERRIDE; |
- ConstrainedWebDialogDelegate* constrained_web_dialog_delegate() { |
- return constrained_web_dialog_delegate_; |
- } |
- |
private: |
- virtual ~TabModalConfirmDialogWebUI(); |
- |
- // TabModalConfirmDialog: |
- virtual void AcceptTabModalDialog() OVERRIDE; |
- virtual void CancelTabModalDialog() OVERRIDE; |
+ virtual ~ManagedUserPassphraseDialog(); |
- scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
+ // Creates and initializes the WebUIDataSource which is used for this dialog. |
+ void CreateDataSource(Profile* profile) const; |
- // Deletes itself. |
- ConstrainedWebDialogDelegate* constrained_web_dialog_delegate_; |
+ PassphraseCheckedCallback callback_; |
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI); |
+ DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphraseDialog); |
}; |
-#endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
+#endif // CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_ |