| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 9 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 WebContentsModalDialogManagerDelegate* d) { | 28 WebContentsModalDialogManagerDelegate* d) { |
| 29 delegate_ = d; | 29 delegate_ = d; |
| 30 | 30 |
| 31 for (WebContentsModalDialogList::iterator it = child_dialogs_.begin(); | 31 for (WebContentsModalDialogList::iterator it = child_dialogs_.begin(); |
| 32 it != child_dialogs_.end(); it++) { | 32 it != child_dialogs_.end(); it++) { |
| 33 // Delegate can be NULL on Views/Win32 during tab drag. | 33 // Delegate can be NULL on Views/Win32 during tab drag. |
| 34 (*it)->manager->HostChanged(d ? d->GetWebContentsModalDialogHost() : NULL); | 34 (*it)->manager->HostChanged(d ? d->GetWebContentsModalDialogHost() : NULL); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 void WebContentsModalDialogManager::ShowModalDialog(gfx::NativeWindow dialog) { | |
| 39 std::unique_ptr<SingleWebContentsDialogManager> mgr( | |
| 40 CreateNativeWebModalManager(dialog, this)); | |
| 41 ShowDialogWithManager(dialog, std::move(mgr)); | |
| 42 } | |
| 43 | |
| 44 // TODO(gbillock): Maybe "ShowBubbleWithManager"? | 38 // TODO(gbillock): Maybe "ShowBubbleWithManager"? |
| 45 void WebContentsModalDialogManager::ShowDialogWithManager( | 39 void WebContentsModalDialogManager::ShowDialogWithManager( |
| 46 gfx::NativeWindow dialog, | 40 gfx::NativeWindow dialog, |
| 47 std::unique_ptr<SingleWebContentsDialogManager> manager) { | 41 std::unique_ptr<SingleWebContentsDialogManager> manager) { |
| 48 if (delegate_) | 42 if (delegate_) |
| 49 manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); | 43 manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); |
| 50 child_dialogs_.push_back(new DialogState(dialog, std::move(manager))); | 44 child_dialogs_.push_back(new DialogState(dialog, std::move(manager))); |
| 51 | 45 |
| 52 if (child_dialogs_.size() == 1) { | 46 if (child_dialogs_.size() == 1) { |
| 53 BlockWebContentsInteraction(true); | 47 BlockWebContentsInteraction(true); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // some of these to close. CloseAllDialogs is async, so it might get called | 169 // some of these to close. CloseAllDialogs is async, so it might get called |
| 176 // twice before it runs. | 170 // twice before it runs. |
| 177 CloseAllDialogs(); | 171 CloseAllDialogs(); |
| 178 } | 172 } |
| 179 | 173 |
| 180 void WebContentsModalDialogManager::DidAttachInterstitialPage() { | 174 void WebContentsModalDialogManager::DidAttachInterstitialPage() { |
| 181 CloseAllDialogs(); | 175 CloseAllDialogs(); |
| 182 } | 176 } |
| 183 | 177 |
| 184 } // namespace web_modal | 178 } // namespace web_modal |
| OLD | NEW |