Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: components/web_modal/web_contents_modal_dialog_manager.cc

Issue 231173004: [WebModal] Rename NativeWebContentsModalDialogManager to SingleWebContentsDialogManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
26 WebContentsModalDialogManagerDelegate* d) { 26 WebContentsModalDialogManagerDelegate* d) {
27 delegate_ = d; 27 delegate_ = d;
28 28
29 for (WebContentsModalDialogList::iterator it = child_dialogs_.begin(); 29 for (WebContentsModalDialogList::iterator it = child_dialogs_.begin();
30 it != child_dialogs_.end(); it++) { 30 it != child_dialogs_.end(); it++) {
31 // Delegate can be NULL on Views/Win32 during tab drag. 31 // Delegate can be NULL on Views/Win32 during tab drag.
32 (*it)->manager->HostChanged(d ? d->GetWebContentsModalDialogHost() : NULL); 32 (*it)->manager->HostChanged(d ? d->GetWebContentsModalDialogHost() : NULL);
33 } 33 }
34 } 34 }
35 35
36 // TODO(gbillock): Rename to ShowWebModalDialog() 36 void WebContentsModalDialogManager::ShowWebModalDialog(
37 void WebContentsModalDialogManager::ShowDialog(
38 NativeWebContentsModalDialog dialog) { 37 NativeWebContentsModalDialog dialog) {
39 scoped_ptr<NativeWebContentsModalDialogManager> mgr( 38 scoped_ptr<SingleWebContentsDialogManager> mgr(
40 CreateNativeManager(this)); 39 CreateNativeWebModalManager(this));
41 ShowDialogWithManager(dialog, mgr.Pass()); 40 ShowDialogWithManager(dialog, mgr.Pass());
42 } 41 }
43 42
44 // TODO(gbillock): Maybe "ShowBubbleWithManager"? 43 // TODO(gbillock): Maybe "ShowBubbleWithManager"?
45 void WebContentsModalDialogManager::ShowDialogWithManager( 44 void WebContentsModalDialogManager::ShowDialogWithManager(
46 NativeWebContentsModalDialog dialog, 45 NativeWebContentsModalDialog dialog,
47 scoped_ptr<NativeWebContentsModalDialogManager> manager) { 46 scoped_ptr<SingleWebContentsDialogManager> manager) {
48 if (delegate_) 47 if (delegate_)
49 manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); 48 manager->HostChanged(delegate_->GetWebContentsModalDialogHost());
50 child_dialogs_.push_back(new DialogState(dialog, manager.Pass())); 49 child_dialogs_.push_back(new DialogState(dialog, manager.Pass()));
51 50
52 child_dialogs_.back()->manager->ManageDialog(dialog); 51 child_dialogs_.back()->manager->ManageDialog(dialog);
53 52
54 if (child_dialogs_.size() == 1) { 53 if (child_dialogs_.size() == 1) {
55 BlockWebContentsInteraction(true); 54 BlockWebContentsInteraction(true);
56 if (delegate_ && delegate_->IsWebContentsVisible(web_contents())) 55 if (delegate_ && delegate_->IsWebContentsVisible(web_contents()))
57 child_dialogs_.back()->manager->ShowDialog(dialog); 56 child_dialogs_.back()->manager->ShowDialog(dialog);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 100
102 WebContentsModalDialogManager::WebContentsModalDialogManager( 101 WebContentsModalDialogManager::WebContentsModalDialogManager(
103 content::WebContents* web_contents) 102 content::WebContents* web_contents)
104 : content::WebContentsObserver(web_contents), 103 : content::WebContentsObserver(web_contents),
105 delegate_(NULL), 104 delegate_(NULL),
106 closing_all_dialogs_(false) { 105 closing_all_dialogs_(false) {
107 } 106 }
108 107
109 WebContentsModalDialogManager::DialogState::DialogState( 108 WebContentsModalDialogManager::DialogState::DialogState(
110 NativeWebContentsModalDialog dialog, 109 NativeWebContentsModalDialog dialog,
111 scoped_ptr<NativeWebContentsModalDialogManager> mgr) 110 scoped_ptr<SingleWebContentsDialogManager> mgr)
112 : dialog(dialog), 111 : dialog(dialog),
113 manager(mgr.release()), 112 manager(mgr.release()),
114 #if defined(OS_WIN) || defined(USE_AURA) 113 #if defined(OS_WIN) || defined(USE_AURA)
115 close_on_interstitial_webui(true) 114 close_on_interstitial_webui(true)
116 #else 115 #else
117 // TODO(wittman): Test that closing on interstitial webui works properly 116 // TODO(wittman): Test that closing on interstitial webui works properly
118 // on Mac and use the true default for all platforms. 117 // on Mac and use the true default for all platforms.
119 close_on_interstitial_webui(false) 118 close_on_interstitial_webui(false)
120 #endif 119 #endif
121 { 120 {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // list. 205 // list.
207 WebContentsModalDialogList dialogs(child_dialogs_); 206 WebContentsModalDialogList dialogs(child_dialogs_);
208 for (WebContentsModalDialogList::iterator it = dialogs.begin(); 207 for (WebContentsModalDialogList::iterator it = dialogs.begin();
209 it != dialogs.end(); ++it) { 208 it != dialogs.end(); ++it) {
210 if ((*it)->close_on_interstitial_webui) 209 if ((*it)->close_on_interstitial_webui)
211 (*it)->manager->CloseDialog((*it)->dialog); 210 (*it)->manager->CloseDialog((*it)->dialog);
212 } 211 }
213 } 212 }
214 213
215 } // namespace web_modal 214 } // namespace web_modal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698