OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ |
6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/javascript_dialog_manager.h" | 11 #include "content/public/browser/javascript_dialog_manager.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class ShellJavaScriptDialog; | 15 class ShellJavaScriptDialog; |
16 | 16 |
17 class ShellJavaScriptDialogManager : public JavaScriptDialogManager { | 17 class ShellJavaScriptDialogManager : public JavaScriptDialogManager { |
18 public: | 18 public: |
19 ShellJavaScriptDialogManager(); | 19 ShellJavaScriptDialogManager(); |
20 virtual ~ShellJavaScriptDialogManager(); | 20 ~ShellJavaScriptDialogManager() override; |
21 | 21 |
22 // JavaScriptDialogManager: | 22 // JavaScriptDialogManager: |
23 virtual void RunJavaScriptDialog( | 23 void RunJavaScriptDialog(WebContents* web_contents, |
24 WebContents* web_contents, | 24 const GURL& origin_url, |
25 const GURL& origin_url, | 25 const std::string& accept_lang, |
26 const std::string& accept_lang, | 26 JavaScriptMessageType javascript_message_type, |
27 JavaScriptMessageType javascript_message_type, | 27 const base::string16& message_text, |
28 const base::string16& message_text, | 28 const base::string16& default_prompt_text, |
29 const base::string16& default_prompt_text, | 29 const DialogClosedCallback& callback, |
30 const DialogClosedCallback& callback, | 30 bool* did_suppress_message) override; |
31 bool* did_suppress_message) override; | |
32 | 31 |
33 virtual void RunBeforeUnloadDialog( | 32 void RunBeforeUnloadDialog(WebContents* web_contents, |
34 WebContents* web_contents, | 33 const base::string16& message_text, |
35 const base::string16& message_text, | 34 bool is_reload, |
36 bool is_reload, | 35 const DialogClosedCallback& callback) override; |
37 const DialogClosedCallback& callback) override; | |
38 | 36 |
39 virtual void CancelActiveAndPendingDialogs( | 37 void CancelActiveAndPendingDialogs(WebContents* web_contents) override; |
40 WebContents* web_contents) override; | |
41 | 38 |
42 virtual void WebContentsDestroyed(WebContents* web_contents) override; | 39 void WebContentsDestroyed(WebContents* web_contents) override; |
43 | 40 |
44 // Called by the ShellJavaScriptDialog when it closes. | 41 // Called by the ShellJavaScriptDialog when it closes. |
45 void DialogClosed(ShellJavaScriptDialog* dialog); | 42 void DialogClosed(ShellJavaScriptDialog* dialog); |
46 | 43 |
47 // Used for content_browsertests. | 44 // Used for content_browsertests. |
48 void set_dialog_request_callback(const base::Closure& callback) { | 45 void set_dialog_request_callback(const base::Closure& callback) { |
49 dialog_request_callback_ = callback; | 46 dialog_request_callback_ = callback; |
50 } | 47 } |
51 | 48 |
52 private: | 49 private: |
53 #if defined(OS_MACOSX) || defined(OS_WIN) | 50 #if defined(OS_MACOSX) || defined(OS_WIN) |
54 // The dialog being shown. No queueing. | 51 // The dialog being shown. No queueing. |
55 scoped_ptr<ShellJavaScriptDialog> dialog_; | 52 scoped_ptr<ShellJavaScriptDialog> dialog_; |
56 #else | 53 #else |
57 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if | 54 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if |
58 #endif | 55 #endif |
59 | 56 |
60 base::Closure dialog_request_callback_; | 57 base::Closure dialog_request_callback_; |
61 | 58 |
62 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogManager); | 59 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogManager); |
63 }; | 60 }; |
64 | 61 |
65 } // namespace content | 62 } // namespace content |
66 | 63 |
67 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ | 64 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_ |
OLD | NEW |