| 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 "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 5 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" | 7 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "content/public/browser/navigation_details.h" | 9 #include "content/public/browser/navigation_details.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 closing_all_dialogs_ = false; | 130 closing_all_dialogs_ = false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void WebContentsModalDialogManager::DidNavigateMainFrame( | 133 void WebContentsModalDialogManager::DidNavigateMainFrame( |
| 134 const content::LoadCommittedDetails& details, | 134 const content::LoadCommittedDetails& details, |
| 135 const content::FrameNavigateParams& params) { | 135 const content::FrameNavigateParams& params) { |
| 136 // Close constrained windows if necessary. | 136 // Close constrained windows if necessary. |
| 137 if (!net::RegistryControlledDomainService::SameDomainOrHost( | 137 if (!net::RegistryControlledDomainService::SameDomainOrHost( |
| 138 details.previous_url, details.entry->GetURL())) | 138 details.previous_url, details.entry->GetURL(), |
| 139 net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) |
| 139 CloseAllDialogs(); | 140 CloseAllDialogs(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void WebContentsModalDialogManager::DidGetIgnoredUIEvent() { | 143 void WebContentsModalDialogManager::DidGetIgnoredUIEvent() { |
| 143 if (dialog_count()) | 144 if (dialog_count()) |
| 144 native_manager_->FocusDialog(*dialog_begin()); | 145 native_manager_->FocusDialog(*dialog_begin()); |
| 145 } | 146 } |
| 146 | 147 |
| 147 void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) { | 148 void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) { |
| 148 // First cleanly close all child dialogs. | 149 // First cleanly close all child dialogs. |
| 149 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 150 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 150 // some of these to close. CloseAllDialogs is async, so it might get called | 151 // some of these to close. CloseAllDialogs is async, so it might get called |
| 151 // twice before it runs. | 152 // twice before it runs. |
| 152 CloseAllDialogs(); | 153 CloseAllDialogs(); |
| 153 } | 154 } |
| OLD | NEW |