| 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 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 5 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 6 | 6 |
| 7 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 7 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 8 #include "content/public/browser/navigation_details.h" | 8 #include "content/public/browser/navigation_details.h" |
| 9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void WebContentsModalDialogManager::WasShown() { | 180 void WebContentsModalDialogManager::WasShown() { |
| 181 if (!child_dialogs_.empty()) | 181 if (!child_dialogs_.empty()) |
| 182 child_dialogs_.front()->manager->Show(); | 182 child_dialogs_.front()->manager->Show(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void WebContentsModalDialogManager::WasHidden() { | 185 void WebContentsModalDialogManager::WasHidden() { |
| 186 if (!child_dialogs_.empty()) | 186 if (!child_dialogs_.empty()) |
| 187 child_dialogs_.front()->manager->Hide(); | 187 child_dialogs_.front()->manager->Hide(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) { | 190 void WebContentsModalDialogManager::WebContentsDestroyed() { |
| 191 // First cleanly close all child dialogs. | 191 // First cleanly close all child dialogs. |
| 192 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 192 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 193 // some of these to close. CloseAllDialogs is async, so it might get called | 193 // some of these to close. CloseAllDialogs is async, so it might get called |
| 194 // twice before it runs. | 194 // twice before it runs. |
| 195 CloseAllDialogs(); | 195 CloseAllDialogs(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void WebContentsModalDialogManager::DidAttachInterstitialPage() { | 198 void WebContentsModalDialogManager::DidAttachInterstitialPage() { |
| 199 // Copy the dialogs so we can close and remove them while iterating over the | 199 // Copy the dialogs so we can close and remove them while iterating over the |
| 200 // list. | 200 // list. |
| 201 WebContentsModalDialogList dialogs(child_dialogs_); | 201 WebContentsModalDialogList dialogs(child_dialogs_); |
| 202 for (WebContentsModalDialogList::iterator it = dialogs.begin(); | 202 for (WebContentsModalDialogList::iterator it = dialogs.begin(); |
| 203 it != dialogs.end(); ++it) { | 203 it != dialogs.end(); ++it) { |
| 204 if ((*it)->close_on_interstitial_webui) | 204 if ((*it)->close_on_interstitial_webui) |
| 205 (*it)->manager->Close(); | 205 (*it)->manager->Close(); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace web_modal | 209 } // namespace web_modal |
| OLD | NEW |