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

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

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Various fixes Created 4 years, 4 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
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 <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 23 matching lines...) Expand all
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) { 38 void WebContentsModalDialogManager::ShowModalDialog(gfx::NativeWindow dialog) {
39 std::unique_ptr<SingleWebContentsDialogManager> mgr( 39 std::unique_ptr<SingleWebContentsDialogManager> mgr(
40 CreateNativeWebModalManager(dialog, this)); 40 CreateNativeWebModalManager(dialog, this));
41 ShowDialogWithManager(dialog, std::move(mgr)); 41 ShowDialogWithManager(dialog, std::move(mgr));
42 } 42 }
43 43
44 // Shows the modal dialog and records that it has a non clipped display (not
45 // constrained to bounds of parent window).
46 void WebContentsModalDialogManager::ShowNonClippedModalDialog(
47 gfx::NativeWindow dialog) {
48 nonclipped_child_dialogs_.insert(dialog);
49 std::unique_ptr<SingleWebContentsDialogManager> mgr(
50 CreateNativeWebModalManager(dialog, this));
51 ShowDialogWithManager(dialog, std::move(mgr));
52 }
53
44 // TODO(gbillock): Maybe "ShowBubbleWithManager"? 54 // TODO(gbillock): Maybe "ShowBubbleWithManager"?
45 void WebContentsModalDialogManager::ShowDialogWithManager( 55 void WebContentsModalDialogManager::ShowDialogWithManager(
46 gfx::NativeWindow dialog, 56 gfx::NativeWindow dialog,
47 std::unique_ptr<SingleWebContentsDialogManager> manager) { 57 std::unique_ptr<SingleWebContentsDialogManager> manager) {
48 if (delegate_) 58 if (delegate_)
49 manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); 59 manager->HostChanged(delegate_->GetWebContentsModalDialogHost());
50 child_dialogs_.push_back(new DialogState(dialog, std::move(manager))); 60 child_dialogs_.push_back(new DialogState(dialog, std::move(manager)));
51 61
52 if (child_dialogs_.size() == 1) { 62 if (child_dialogs_.size() == 1) {
53 BlockWebContentsInteraction(true); 63 BlockWebContentsInteraction(true);
(...skipping 16 matching lines...) Expand all
70 } 80 }
71 81
72 void WebContentsModalDialogManager::WillClose(gfx::NativeWindow dialog) { 82 void WebContentsModalDialogManager::WillClose(gfx::NativeWindow dialog) {
73 WebContentsModalDialogList::iterator dlg = FindDialogState(dialog); 83 WebContentsModalDialogList::iterator dlg = FindDialogState(dialog);
74 84
75 // The Views tab contents modal dialog calls WillClose twice. Ignore the 85 // The Views tab contents modal dialog calls WillClose twice. Ignore the
76 // second invocation. 86 // second invocation.
77 if (dlg == child_dialogs_.end()) 87 if (dlg == child_dialogs_.end())
78 return; 88 return;
79 89
90 nonclipped_child_dialogs_.erase(dialog);
80 bool removed_topmost_dialog = dlg == child_dialogs_.begin(); 91 bool removed_topmost_dialog = dlg == child_dialogs_.begin();
81 std::unique_ptr<DialogState> deleter(*dlg); 92 std::unique_ptr<DialogState> deleter(*dlg);
82 child_dialogs_.erase(dlg); 93 child_dialogs_.erase(dlg);
83 if (!child_dialogs_.empty() && removed_topmost_dialog && 94 if (!child_dialogs_.empty() && removed_topmost_dialog &&
84 !closing_all_dialogs_) { 95 !closing_all_dialogs_) {
85 child_dialogs_.front()->manager->Show(); 96 child_dialogs_.front()->manager->Show();
86 } 97 }
87 98
88 BlockWebContentsInteraction(!child_dialogs_.empty()); 99 BlockWebContentsInteraction(!child_dialogs_.empty());
89 } 100 }
90 101
102 bool WebContentsModalDialogManager::IsNonClipped(
103 gfx::NativeWindow dialog) const {
104 if (nonclipped_child_dialogs_.find(dialog) !=
Mike Wittman 2016/08/15 19:36:37 return nonclipped_child_dialogs_.find(dialog) != n
rbpotter 2016/08/15 21:32:54 Done.
105 nonclipped_child_dialogs_.end())
106 return true;
107 return false;
108 }
109
91 WebContentsModalDialogManager::WebContentsModalDialogManager( 110 WebContentsModalDialogManager::WebContentsModalDialogManager(
92 content::WebContents* web_contents) 111 content::WebContents* web_contents)
93 : content::WebContentsObserver(web_contents), 112 : content::WebContentsObserver(web_contents),
94 delegate_(NULL), 113 delegate_(NULL),
95 closing_all_dialogs_(false) { 114 closing_all_dialogs_(false) {
96 } 115 }
97 116
98 WebContentsModalDialogManager::DialogState::DialogState( 117 WebContentsModalDialogManager::DialogState::DialogState(
99 gfx::NativeWindow dialog, 118 gfx::NativeWindow dialog,
100 std::unique_ptr<SingleWebContentsDialogManager> mgr) 119 std::unique_ptr<SingleWebContentsDialogManager> mgr)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // 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
176 // twice before it runs. 195 // twice before it runs.
177 CloseAllDialogs(); 196 CloseAllDialogs();
178 } 197 }
179 198
180 void WebContentsModalDialogManager::DidAttachInterstitialPage() { 199 void WebContentsModalDialogManager::DidAttachInterstitialPage() {
181 CloseAllDialogs(); 200 CloseAllDialogs();
182 } 201 }
183 202
184 } // namespace web_modal 203 } // namespace web_modal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698