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

Side by Side Diff: components/constrained_window/constrained_window_views.cc

Issue 1234073002: Allow cert-popup for WebView guests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 5 years, 5 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/constrained_window/constrained_window_views.h" 5 #include "components/constrained_window/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "components/constrained_window/constrained_window_views_client.h" 9 #include "components/constrained_window/constrained_window_views_client.h"
10 #include "components/guest_view/browser/guest_view_base.h" 10 #include "components/guest_view/browser/guest_view_base.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 size.SetToMin(max_size); 123 size.SetToMin(max_size);
124 UpdateModalDialogPosition(widget, dialog_host, size); 124 UpdateModalDialogPosition(widget, dialog_host, size);
125 } 125 }
126 126
127 void UpdateWidgetModalDialogPosition(views::Widget* widget, 127 void UpdateWidgetModalDialogPosition(views::Widget* widget,
128 web_modal::ModalDialogHost* dialog_host) { 128 web_modal::ModalDialogHost* dialog_host) {
129 UpdateModalDialogPosition(widget, dialog_host, 129 UpdateModalDialogPosition(widget, dialog_host,
130 widget->GetRootView()->GetPreferredSize()); 130 widget->GetRootView()->GetPreferredSize());
131 } 131 }
132 132
133 bool HasTopLevelDialogManager(content::WebContents* web_contents) {
134 // For embedded WebContents, use the embedder's WebContents for constrained
135 // window.
136 content::WebContents* top_level_web_contents =
137 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents);
jochen (gone - plz use gerrit) 2015/07/15 13:34:01 is the return value guaranteed to be non-NULL? it'
wjmaclean 2015/07/15 13:59:58 Yes, the return value is guaranteed to be non-null
138 return web_modal::WebContentsModalDialogManager::FromWebContents(
139 top_level_web_contents) != nullptr;
140 }
141
133 views::Widget* ShowWebModalDialogViews( 142 views::Widget* ShowWebModalDialogViews(
134 views::WidgetDelegate* dialog, 143 views::WidgetDelegate* dialog,
135 content::WebContents* initiator_web_contents) { 144 content::WebContents* initiator_web_contents) {
136 DCHECK(constrained_window_views_client); 145 DCHECK(constrained_window_views_client);
137 // For embedded WebContents, use the embedder's WebContents for constrained 146 // For embedded WebContents, use the embedder's WebContents for constrained
138 // window. 147 // window.
139 content::WebContents* web_contents = 148 content::WebContents* web_contents =
140 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); 149 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents);
141 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); 150 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents);
142 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) 151 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 DCHECK_EQ(parent_view, host->GetHostView()); 183 DCHECK_EQ(parent_view, host->GetHostView());
175 ModalDialogHostObserver* dialog_host_observer = 184 ModalDialogHostObserver* dialog_host_observer =
176 new WidgetModalDialogHostObserverViews( 185 new WidgetModalDialogHostObserverViews(
177 host, widget, kWidgetModalDialogHostObserverViewsKey); 186 host, widget, kWidgetModalDialogHostObserverViewsKey);
178 dialog_host_observer->OnPositionRequiresUpdate(); 187 dialog_host_observer->OnPositionRequiresUpdate();
179 } 188 }
180 return widget; 189 return widget;
181 } 190 }
182 191
183 } // namespace constrained window 192 } // namespace constrained window
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698