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

Unified Diff: chrome/browser/chromeos/login/webui_login_view.cc

Issue 15879007: Support web contents modal dialogs within SimpleWebViewDialog and WebUILoginView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/webui_login_view.cc
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 545e4b350c6bc21b94f49ae00224a5dbaf8c8f5f..c9a456420e29275f22bdc3fd16741b65d2f631db 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -198,6 +198,8 @@ void WebUILoginView::Init(views::Widget* login_window) {
// LoginHandlerViews uses a constrained window for the password manager view.
WebContentsModalDialogManager::CreateForWebContents(web_contents);
+ WebContentsModalDialogManager::FromWebContents(web_contents)->
+ set_delegate(this);
web_contents->SetDelegate(this);
renderer_preferences_util::UpdateFromSystemSettings(
@@ -213,6 +215,33 @@ const char* WebUILoginView::GetClassName() const {
return kViewClassName;
}
+web_modal::WebContentsModalDialogHost*
+ WebUILoginView::GetWebContentsModalDialogHost() {
+ return this;
+}
+
+gfx::NativeView WebUILoginView::GetHostView() const {
+ return GetWidget()->GetNativeView();
+}
+
+gfx::Point WebUILoginView::GetDialogPosition(const gfx::Size& size) {
+ // Center the widget.
+ gfx::Size widget_size = GetWidget()->GetWindowBoundsInScreen().size();
+ return gfx::Point(widget_size.width() / 2 - size.width() / 2,
+ widget_size.height() / 2 - size.height() / 2);
+}
+
+void WebUILoginView::AddObserver(
+ web_modal::WebContentsModalDialogHostObserver* observer) {
+ if (observer && !observer_list_.HasObserver(observer))
+ observer_list_.AddObserver(observer);
+}
+
+void WebUILoginView::RemoveObserver(
+ web_modal::WebContentsModalDialogHostObserver* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
bool WebUILoginView::AcceleratorPressed(
const ui::Accelerator& accelerator) {
AccelMap::const_iterator entry = accel_map_.find(accelerator);
@@ -299,6 +328,10 @@ void WebUILoginView::SetUIEnabled(bool enabled) {
void WebUILoginView::Layout() {
DCHECK(webui_login_);
webui_login_->SetBoundsRect(bounds());
+
+ FOR_EACH_OBSERVER(web_modal::WebContentsModalDialogHostObserver,
+ observer_list_,
+ OnPositionRequiresUpdate());
}
void WebUILoginView::OnLocaleChanged() {
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698