| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/ui/browser_list_observer.h" | 12 #include "chrome/browser/ui/browser_list_observer.h" |
| 13 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" |
| 13 #include "content/public/browser/javascript_dialog_manager.h" | 14 #include "content/public/browser/javascript_dialog_manager.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/browser/web_contents_user_data.h" | 16 #include "content/public/browser/web_contents_user_data.h" |
| 16 | 17 |
| 17 class JavaScriptDialogViews; | 18 class JavaScriptDialogViews; |
| 18 | 19 |
| 19 // A class, attached to WebContentses in browser windows, that is the | 20 // A class, attached to WebContentses in browser windows, that is the |
| 20 // JavaScriptDialogManager for them and handles displaying their dialogs. | 21 // JavaScriptDialogManager for them and handles displaying their dialogs. |
| 21 // | 22 // |
| 22 // This is the primary mechanism for implementing auto-dismissing dialogs, | 23 // This is the primary mechanism for implementing auto-dismissing dialogs, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void OnBrowserSetLastActive(Browser* browser) override; | 62 void OnBrowserSetLastActive(Browser* browser) override; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; | 65 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; |
| 65 | 66 |
| 66 void CloseDialog(bool suppress_callback, | 67 void CloseDialog(bool suppress_callback, |
| 67 bool success, | 68 bool success, |
| 68 const base::string16& user_input); | 69 const base::string16& user_input); |
| 69 | 70 |
| 70 // The dialog being displayed on the observed WebContents. | 71 // The dialog being displayed on the observed WebContents. |
| 71 base::WeakPtr<JavaScriptDialogViews> dialog_; | 72 base::WeakPtr<JavaScriptDialog> dialog_; |
| 72 | 73 |
| 73 // The callback provided for when the dialog is closed. Usually the dialog | 74 // The callback provided for when the dialog is closed. Usually the dialog |
| 74 // itself calls it, but in the cases where the dialog is closed not by the | 75 // itself calls it, but in the cases where the dialog is closed not by the |
| 75 // user's input but by a call to |CloseDialog|, this class will call it. | 76 // user's input but by a call to |CloseDialog|, this class will call it. |
| 76 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | 77 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
| 77 | 78 |
| 78 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); | 79 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 82 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| OLD | NEW |