OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/ui/browser_list_observer.h" | 13 #include "chrome/browser/ui/browser_list_observer.h" |
14 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" | 14 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" |
15 #include "content/public/browser/javascript_dialog_manager.h" | 15 #include "content/public/browser/javascript_dialog_manager.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
18 | 18 |
19 class JavaScriptDialogViews; | |
20 | |
21 // A class, attached to WebContentses in browser windows, that is the | 19 // A class, attached to WebContentses in browser windows, that is the |
22 // JavaScriptDialogManager for them and handles displaying their dialogs. | 20 // JavaScriptDialogManager for them and handles displaying their dialogs. |
23 // | 21 // |
24 // This is the primary mechanism for implementing auto-dismissing dialogs, | 22 // This is the primary mechanism for implementing auto-dismissing dialogs, |
25 // dialogs that close when the user switches away to a different tab. Because | 23 // dialogs that close when the user switches away to a different tab. Because |
26 // JavaScript dialogs are synchronous and block arbitrary sets of renderers, | 24 // JavaScript dialogs are synchronous and block arbitrary sets of renderers, |
27 // they cannot be made tab-modal. Therefore the next best option is to make them | 25 // they cannot be made tab-modal. Therefore the next best option is to make them |
28 // auto-closing, so that they never block the user's access to other renderers. | 26 // auto-closing, so that they never block the user's access to other renderers. |
29 // | 27 // |
30 // See http://bit.ly/project-oldspice for more details. Note that only part | 28 // See http://bit.ly/project-oldspice for more details. Note that only part |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // itself calls it, but in the cases where the dialog is closed not by the | 84 // itself calls it, but in the cases where the dialog is closed not by the |
87 // user's input but by a call to |CloseDialog|, this class will call it. | 85 // user's input but by a call to |CloseDialog|, this class will call it. |
88 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | 86 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
89 | 87 |
90 base::Closure dialog_shown_; | 88 base::Closure dialog_shown_; |
91 | 89 |
92 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); | 90 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); |
93 }; | 91 }; |
94 | 92 |
95 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 93 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
OLD | NEW |