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

Side by Side Diff: content/browser/javascript_dialogs.h

Issue 7096016: Remove JS dialog dependency from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now a tc delegate Created 9 years, 6 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
(Empty)
1 // Copyright (c) 2011 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 CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_
6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_
7 #pragma once
8
9 #include "base/string16.h"
10 #include "ui/gfx/native_widget_types.h"
11
12 class ExtensionHost;
13 class GURL;
14 class Profile;
15 class TabContents;
16
17 namespace IPC {
18 class Message;
19 }
20
21 namespace content {
22
23 class JavaScriptDialogDelegate {
jam 2011/06/03 00:21:45 can you give a brief description of each class in
24 public:
25 // This callback is invoked when the dialog is closed.
26 virtual void OnDialogClosed(IPC::Message* reply_msg,
27 bool success,
28 const string16& user_input) = 0;
29
30 // Returns the root native window with which to associate the dialog.
31 virtual gfx::NativeWindow GetDialogRootWindow() = 0;
32
33 // Returns the TabContents implementing this delegate, or NULL if there is
34 // none. TODO(avi): This breaks encapsulation and in general sucks; figure out
35 // a better way of doing this.
36 virtual TabContents* AsTabContents() = 0;
37
38 // Returns the ExtensionHost implementing this delegate, or NULL if there is
39 // none. TODO(avi): This is even suckier than AsTabContents above as it breaks
40 // layering; figure out a better way of doing this. http://crbug.com/84604
41 virtual ExtensionHost* AsExtensionHost() = 0;
42
43 protected:
44 virtual ~JavaScriptDialogDelegate() {}
45 };
46
47 class JavaScriptDialogCreator {
48 public:
49 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if
50 // |true| is returned in it, the caller will handle faking the reply.
51 // TODO(avi): Remove Profile from this call; http://crbug.com/84601
52 virtual void RunJavaScriptDialog(JavaScriptDialogDelegate* delegate,
53 const GURL& frame_url,
54 int dialog_flags,
55 const string16& message_text,
56 const string16& default_prompt_text,
57 IPC::Message* reply_message,
58 bool* did_suppress_message,
59 Profile* profile) = 0;
60
61 // Displays a dialog asking the user if they want to leave a page.
62 virtual void RunBeforeUnloadDialog(JavaScriptDialogDelegate* delegate,
63 const string16& message_text,
64 IPC::Message* reply_message) = 0;
65
66 // Resets any saved JavaScript dialog state for the delegate.
67 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0;
68
69 protected:
70 virtual ~JavaScriptDialogCreator() {}
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698