OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/web_modal/popup_manager.h" | |
6 | |
7 #include "components/web_modal/web_contents_modal_dialog_manager.h" | |
8 #include "content/public/browser/navigation_details.h" | |
9 #include "content/public/browser/navigation_entry.h" | |
10 #include "content/public/browser/render_view_host.h" | |
11 #include "content/public/browser/web_contents.h" | |
12 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
Mike Wittman
2014/06/02 19:54:50
I think all these includes can be removed except f
Greg Billock
2014/06/03 01:30:07
Done.
| |
13 | |
14 using content::WebContents; | |
15 | |
16 namespace web_modal { | |
17 | |
18 PopupManager::PopupManager() { | |
19 } | |
20 | |
21 PopupManager::~PopupManager() { | |
22 } | |
23 | |
24 void PopupManager::ShowPopup(scoped_ptr<SinglePopupManager> manager) { | |
25 content::WebContents* web_contents = manager->GetBoundWebContents(); | |
26 // TODO(gbillock): get rid of this when we handle bubbles | |
27 DCHECK(web_contents); | |
28 | |
29 // TODO(gbillock): remove when we port the popup management logic to this | |
30 // class. | |
31 NativeWebContentsModalDialog dialog = | |
32 static_cast<NativeWebContentsModalDialog>(manager->popup()); | |
33 | |
34 WebContentsModalDialogManager* wm_manager = | |
35 WebContentsModalDialogManager::FromWebContents(web_contents); | |
36 DCHECK(wm_manager); | |
37 wm_manager->ShowModalDialog(dialog); | |
38 } | |
39 | |
40 | |
41 bool PopupManager::IsWebModalDialogActive( | |
42 const content::WebContents* web_contents) const { | |
43 if (web_contents == NULL) | |
44 return false; | |
45 | |
46 const WebContentsModalDialogManager* manager = | |
47 WebContentsModalDialogManager::FromWebContents(web_contents); | |
48 return manager ? manager->IsDialogActive() : false; | |
49 } | |
50 | |
51 void PopupManager::WasFocused(const content::WebContents* web_contents) { | |
52 if (!IsWebModalDialogActive(web_contents)) | |
53 return; | |
54 | |
55 const WebContentsModalDialogManager* manager = | |
56 WebContentsModalDialogManager::FromWebContents(web_contents); | |
57 if (manager) | |
58 manager->FocusTopmostDialog(); | |
59 } | |
60 | |
61 void PopupManager::WillClose(NativePopup popup) { | |
Mike Wittman
2014/06/02 19:54:50
Forward on to WebContentsModalDialogManager::WillC
Greg Billock
2014/06/03 01:30:07
I still need to do a bit more migrating. I haven't
| |
62 } | |
63 | |
64 } // namespace web_modal | |
OLD | NEW |