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