OLD | NEW |
1 // Copyright (c) 2012 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_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ | 5 #ifndef CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ |
6 #define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ | 6 #define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/browser/javascript_dialogs.h" | 11 #include "content/public/browser/javascript_dialogs.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 class ShellJavaScriptDialog; | 15 class ShellJavaScriptDialog; |
15 | 16 |
16 class ShellJavaScriptDialogCreator : public JavaScriptDialogCreator { | 17 class ShellJavaScriptDialogCreator : public JavaScriptDialogCreator { |
17 public: | 18 public: |
18 ShellJavaScriptDialogCreator(); | 19 ShellJavaScriptDialogCreator(); |
(...skipping 14 matching lines...) Expand all Loading... |
33 WebContents* web_contents, | 34 WebContents* web_contents, |
34 const string16& message_text, | 35 const string16& message_text, |
35 bool is_reload, | 36 bool is_reload, |
36 const DialogClosedCallback& callback) OVERRIDE; | 37 const DialogClosedCallback& callback) OVERRIDE; |
37 | 38 |
38 virtual void ResetJavaScriptState(WebContents* web_contents) OVERRIDE; | 39 virtual void ResetJavaScriptState(WebContents* web_contents) OVERRIDE; |
39 | 40 |
40 // Called by the ShellJavaScriptDialog when it closes. | 41 // Called by the ShellJavaScriptDialog when it closes. |
41 void DialogClosed(ShellJavaScriptDialog* dialog); | 42 void DialogClosed(ShellJavaScriptDialog* dialog); |
42 | 43 |
| 44 // Used for content_browsertests. |
| 45 void set_dialog_request_callback( |
| 46 base::Callback<void()> dialog_request_callback) { |
| 47 dialog_request_callback_ = dialog_request_callback; |
| 48 } |
| 49 |
43 private: | 50 private: |
44 #if defined(OS_MACOSX) || defined(OS_WIN) | 51 #if defined(OS_MACOSX) || defined(OS_WIN) |
45 // The dialog being shown. No queueing. | 52 // The dialog being shown. No queueing. |
46 scoped_ptr<ShellJavaScriptDialog> dialog_; | 53 scoped_ptr<ShellJavaScriptDialog> dialog_; |
47 #else | 54 #else |
48 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if | 55 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if |
49 #endif | 56 #endif |
50 | 57 |
| 58 base::Callback<void()> dialog_request_callback_; |
| 59 |
51 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogCreator); | 60 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogCreator); |
52 }; | 61 }; |
53 | 62 |
54 } // namespace content | 63 } // namespace content |
55 | 64 |
56 #endif // CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ | 65 #endif // CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ |
OLD | NEW |