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 COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ | 5 #ifndef COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ |
6 #define COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ | 6 #define COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 private: | 39 private: |
40 friend struct base::DefaultSingletonTraits<JavaScriptDialogManager>; | 40 friend struct base::DefaultSingletonTraits<JavaScriptDialogManager>; |
41 | 41 |
42 JavaScriptDialogManager(); | 42 JavaScriptDialogManager(); |
43 ~JavaScriptDialogManager() override; | 43 ~JavaScriptDialogManager() override; |
44 | 44 |
45 // JavaScriptDialogManager: | 45 // JavaScriptDialogManager: |
46 void RunJavaScriptDialog(content::WebContents* web_contents, | 46 void RunJavaScriptDialog(content::WebContents* web_contents, |
47 const GURL& origin_url, | 47 const GURL& origin_url, |
48 const std::string& accept_lang, | |
49 content::JavaScriptMessageType message_type, | 48 content::JavaScriptMessageType message_type, |
50 const base::string16& message_text, | 49 const base::string16& message_text, |
51 const base::string16& default_prompt_text, | 50 const base::string16& default_prompt_text, |
52 const DialogClosedCallback& callback, | 51 const DialogClosedCallback& callback, |
53 bool* did_suppress_message) override; | 52 bool* did_suppress_message) override; |
54 void RunBeforeUnloadDialog(content::WebContents* web_contents, | 53 void RunBeforeUnloadDialog(content::WebContents* web_contents, |
55 bool is_reload, | 54 bool is_reload, |
56 const DialogClosedCallback& callback) override; | 55 const DialogClosedCallback& callback) override; |
57 bool HandleJavaScriptDialog(content::WebContents* web_contents, | 56 bool HandleJavaScriptDialog(content::WebContents* web_contents, |
58 bool accept, | 57 bool accept, |
59 const base::string16* prompt_override) override; | 58 const base::string16* prompt_override) override; |
60 void CancelActiveAndPendingDialogs( | 59 void CancelActiveAndPendingDialogs( |
61 content::WebContents* web_contents) override; | 60 content::WebContents* web_contents) override; |
62 void ResetDialogState(content::WebContents* web_contents) override; | 61 void ResetDialogState(content::WebContents* web_contents) override; |
63 | 62 |
64 base::string16 GetTitle(content::WebContents* web_contents, | 63 base::string16 GetTitle(content::WebContents* web_contents, |
65 const GURL& origin_url, | 64 const GURL& origin_url, |
66 const std::string& accept_lang, | |
67 bool is_alert); | 65 bool is_alert); |
68 | 66 |
69 // Wrapper around OnDialogClosed; logs UMA stats before continuing on. | 67 // Wrapper around OnDialogClosed; logs UMA stats before continuing on. |
70 void OnBeforeUnloadDialogClosed(content::WebContents* web_contents, | 68 void OnBeforeUnloadDialogClosed(content::WebContents* web_contents, |
71 DialogClosedCallback callback, | 69 DialogClosedCallback callback, |
72 bool success, | 70 bool success, |
73 const base::string16& user_input); | 71 const base::string16& user_input); |
74 | 72 |
75 // Wrapper around a DialogClosedCallback so that we can intercept it before | 73 // Wrapper around a DialogClosedCallback so that we can intercept it before |
76 // passing it onto the original callback. | 74 // passing it onto the original callback. |
(...skipping 13 matching lines...) Expand all Loading... |
90 // dialogs. (Since Javascript dialogs are modal, this is even accurate!) | 88 // dialogs. (Since Javascript dialogs are modal, this is even accurate!) |
91 base::TimeTicks last_close_time_; | 89 base::TimeTicks last_close_time_; |
92 base::TimeTicks last_creation_time_; | 90 base::TimeTicks last_creation_time_; |
93 | 91 |
94 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogManager); | 92 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogManager); |
95 }; | 93 }; |
96 | 94 |
97 } // namespace app_modal | 95 } // namespace app_modal |
98 | 96 |
99 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ | 97 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_H_ |
OLD | NEW |