OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 5 #ifndef CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 #include "ui/base/javascript_message_type.h" | 12 #include "ui/base/javascript_message_type.h" |
12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 | 14 |
14 namespace IPC { | 15 namespace IPC { |
15 class Message; | 16 class Message; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class CONTENT_EXPORT DialogDelegate { | 21 class CONTENT_EXPORT DialogDelegate { |
21 public: | 22 public: |
22 // Returns the root native window with which to associate the dialog. | 23 // Returns the root native window with which to associate the dialog. |
23 virtual gfx::NativeWindow GetDialogRootWindow() const = 0; | 24 virtual gfx::NativeWindow GetDialogRootWindow() const = 0; |
24 | 25 |
25 // Called right before the dialog is shown. | 26 // Called right before the dialog is shown. |
26 virtual void OnDialogShown() {} | 27 virtual void OnDialogShown() {} |
27 | 28 |
28 protected: | 29 protected: |
29 virtual ~DialogDelegate() {} | 30 virtual ~DialogDelegate() {} |
30 }; | 31 }; |
31 | 32 |
32 // A class that invokes a JavaScript dialog must implement this interface to | 33 // A class that invokes a JavaScript dialog must implement this interface to |
33 // allow the dialog implementation to get needed information and return results. | 34 // allow the dialog implementation to get needed information and return results. |
34 class CONTENT_EXPORT JavaScriptDialogDelegate : public DialogDelegate { | 35 class CONTENT_EXPORT JavaScriptDialogDelegate : public DialogDelegate { |
35 public: | 36 public: |
36 // This callback is invoked when the dialog is closed. | 37 // This callback is invoked when the dialog is closed. |
37 virtual void OnDialogClosed(IPC::Message* reply_msg, | 38 virtual void OnDialogClosed(RenderViewHost* rvh, |
| 39 IPC::Message* reply_msg, |
38 bool success, | 40 bool success, |
39 const string16& user_input) = 0; | 41 const string16& user_input) = 0; |
40 | 42 |
41 protected: | 43 protected: |
42 virtual ~JavaScriptDialogDelegate() {} | 44 virtual ~JavaScriptDialogDelegate() {} |
43 }; | 45 }; |
44 | 46 |
45 // An interface consisting of methods that can be called to produce JavaScript | 47 // An interface consisting of methods that can be called to produce JavaScript |
46 // dialogs. | 48 // dialogs. |
47 class JavaScriptDialogCreator { | 49 class JavaScriptDialogCreator { |
(...skipping 25 matching lines...) Expand all Loading... |
73 // for the delegate. | 75 // for the delegate. |
74 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0; | 76 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0; |
75 | 77 |
76 protected: | 78 protected: |
77 virtual ~JavaScriptDialogCreator() {} | 79 virtual ~JavaScriptDialogCreator() {} |
78 }; | 80 }; |
79 | 81 |
80 } // namespace content | 82 } // namespace content |
81 | 83 |
82 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 84 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
OLD | NEW |