| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 5 #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
| 6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 NativeWebContentsModalDialog dialog, | 42 NativeWebContentsModalDialog dialog, |
| 43 scoped_ptr<SingleWebContentsDialogManager> manager); | 43 scoped_ptr<SingleWebContentsDialogManager> manager); |
| 44 | 44 |
| 45 // Returns true if any dialogs are active and not closed. | 45 // Returns true if any dialogs are active and not closed. |
| 46 bool IsDialogActive() const; | 46 bool IsDialogActive() const; |
| 47 | 47 |
| 48 // Focus the topmost modal dialog. IsDialogActive() must be true when calling | 48 // Focus the topmost modal dialog. IsDialogActive() must be true when calling |
| 49 // this function. | 49 // this function. |
| 50 void FocusTopmostDialog(); | 50 void FocusTopmostDialog(); |
| 51 | 51 |
| 52 // Set to true to close the window when a page load starts on the WebContents. | |
| 53 void SetCloseOnInterstitialPage(NativeWebContentsModalDialog dialog, | |
| 54 bool close); | |
| 55 | |
| 56 // Overriden from SingleWebContentsDialogManagerDelegate: | 52 // Overriden from SingleWebContentsDialogManagerDelegate: |
| 57 virtual content::WebContents* GetWebContents() const OVERRIDE; | 53 virtual content::WebContents* GetWebContents() const OVERRIDE; |
| 58 // Called when a WebContentsModalDialogs we own is about to be closed. | 54 // Called when a WebContentsModalDialogs we own is about to be closed. |
| 59 virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE; | 55 virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE; |
| 60 | 56 |
| 61 // For testing. | 57 // For testing. |
| 62 class TestApi { | 58 class TestApi { |
| 63 public: | 59 public: |
| 64 explicit TestApi(WebContentsModalDialogManager* manager) | 60 explicit TestApi(WebContentsModalDialogManager* manager) |
| 65 : manager_(manager) {} | 61 : manager_(manager) {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 explicit WebContentsModalDialogManager(content::WebContents* web_contents); | 75 explicit WebContentsModalDialogManager(content::WebContents* web_contents); |
| 80 friend class content::WebContentsUserData<WebContentsModalDialogManager>; | 76 friend class content::WebContentsUserData<WebContentsModalDialogManager>; |
| 81 | 77 |
| 82 struct DialogState { | 78 struct DialogState { |
| 83 DialogState(NativeWebContentsModalDialog dialog, | 79 DialogState(NativeWebContentsModalDialog dialog, |
| 84 scoped_ptr<SingleWebContentsDialogManager> manager); | 80 scoped_ptr<SingleWebContentsDialogManager> manager); |
| 85 ~DialogState(); | 81 ~DialogState(); |
| 86 | 82 |
| 87 NativeWebContentsModalDialog dialog; | 83 NativeWebContentsModalDialog dialog; |
| 88 scoped_ptr<SingleWebContentsDialogManager> manager; | 84 scoped_ptr<SingleWebContentsDialogManager> manager; |
| 89 bool close_on_interstitial_webui; | |
| 90 }; | 85 }; |
| 91 | 86 |
| 92 typedef std::deque<DialogState*> WebContentsModalDialogList; | 87 typedef std::deque<DialogState*> WebContentsModalDialogList; |
| 93 | 88 |
| 94 // Utility function to get the dialog state for a dialog. | 89 // Utility function to get the dialog state for a dialog. |
| 95 WebContentsModalDialogList::iterator FindDialogState( | 90 WebContentsModalDialogList::iterator FindDialogState( |
| 96 NativeWebContentsModalDialog dialog); | 91 NativeWebContentsModalDialog dialog); |
| 97 | 92 |
| 98 // Blocks/unblocks interaction with renderer process. | 93 // Blocks/unblocks interaction with renderer process. |
| 99 void BlockWebContentsInteraction(bool blocked); | 94 void BlockWebContentsInteraction(bool blocked); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 | 116 |
| 122 // True while closing the dialogs on WebContents close. | 117 // True while closing the dialogs on WebContents close. |
| 123 bool closing_all_dialogs_; | 118 bool closing_all_dialogs_; |
| 124 | 119 |
| 125 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager); | 120 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager); |
| 126 }; | 121 }; |
| 127 | 122 |
| 128 } // namespace web_modal | 123 } // namespace web_modal |
| 129 | 124 |
| 130 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 125 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
| OLD | NEW |