summaryrefslogtreecommitdiffstats
path: root/content/browser/javascript_dialogs.h
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 14:04:34 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 14:04:34 +0000
commita1e97f026180693cb761c6d77d5430b21873a72c (patch)
treeb20796d21a13a13ea9015c0bd1c2ce1285d6969f /content/browser/javascript_dialogs.h
parentca024677dc75287e81f23c7f1d3176be5d14ac64 (diff)
downloadchromium_src-a1e97f026180693cb761c6d77d5430b21873a72c.zip
chromium_src-a1e97f026180693cb761c6d77d5430b21873a72c.tar.gz
chromium_src-a1e97f026180693cb761c6d77d5430b21873a72c.tar.bz2
For JavaScript dialogs, remove As[Type] members, expand delegates to handle those cases.
BUG=84604 TEST=no visible change Review URL: http://codereview.chromium.org/7283022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/javascript_dialogs.h')
-rw-r--r--content/browser/javascript_dialogs.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/content/browser/javascript_dialogs.h b/content/browser/javascript_dialogs.h
index 20de44b..74297b4 100644
--- a/content/browser/javascript_dialogs.h
+++ b/content/browser/javascript_dialogs.h
@@ -20,33 +20,31 @@ class Message;
namespace content {
+class DialogDelegate {
+ public:
+ // Returns the root native window with which to associate the dialog.
+ virtual gfx::NativeWindow GetDialogRootWindow() = 0;
+
+ // Called right before the dialog is shown.
+ virtual void OnDialogShown() {}
+
+ protected:
+ virtual ~DialogDelegate() {}
+};
+
// A class that invokes a JavaScript dialog must implement this interface to
// allow the dialog implementation to get needed information and return results.
-class JavaScriptDialogDelegate {
+class JavaScriptDialogDelegate : public DialogDelegate {
public:
// This callback is invoked when the dialog is closed.
virtual void OnDialogClosed(IPC::Message* reply_msg,
bool success,
const string16& user_input) = 0;
- // Returns the root native window with which to associate the dialog.
- virtual gfx::NativeWindow GetDialogRootWindow() = 0;
-
- // Returns the TabContents implementing this delegate, or NULL if there is
- // none. TODO(avi): This breaks encapsulation and in general sucks; figure out
- // a better way of doing this.
- virtual TabContents* AsTabContents() = 0;
-
- // Returns the ExtensionHost implementing this delegate, or NULL if there is
- // none. TODO(avi): This is even suckier than AsTabContents above as it breaks
- // layering; figure out a better way of doing this. http://crbug.com/84604
- virtual ExtensionHost* AsExtensionHost() = 0;
-
protected:
virtual ~JavaScriptDialogDelegate() {}
};
-
// An interface consisting of methods that can be called to produce JavaScript
// dialogs.
class JavaScriptDialogCreator {
@@ -73,7 +71,8 @@ class JavaScriptDialogCreator {
const string16& message_text,
IPC::Message* reply_message) = 0;
- // Resets any saved JavaScript dialog state for the delegate.
+ // Cancels all pending dialogs and resets any saved JavaScript dialog state
+ // for the delegate.
virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0;
protected: