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

Unified Diff: ui/views/widget/widget.cc

Issue 9250029: Enable KeyboardOverlayDialog on aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the alignment nit. Created 8 years, 11 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 | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 3a77c699ff57fccf405e73bc350bbd17713142fa..05951e837ca0c4d79fb50b3e42357e37d93da866 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -336,6 +336,9 @@ void Widget::Init(const InitParams& params) {
else if (params.show_state == ui::SHOW_STATE_MINIMIZED)
Minimize();
UpdateWindowTitle();
+ } else if (params.delegate) {
+ SetContentsView(params.delegate->GetContentsView());
+ SetInitialBoundsForFramelessWindow(params.bounds);
}
native_widget_initialized_ = true;
}
@@ -406,6 +409,9 @@ const Widget* Widget::GetTopLevelWidget() const {
}
void Widget::SetContentsView(View* view) {
+ // Do not SetContentsView() again if it is already set to the same view.
+ if (view == GetContentsView())
+ return;
root_view_->SetContentsView(view);
if (non_client_view_ != view)
non_client_view_ = NULL;
@@ -1204,6 +1210,21 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
}
}
+void Widget::SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds) {
+ if (bounds.IsEmpty()) {
+ View* contents_view = GetContentsView();
+ DCHECK(contents_view);
+ // No initial bounds supplied, so size the window to its content and
+ // center over its parent if preferred size is provided.
+ gfx::Size size = contents_view->GetPreferredSize();
+ if (!size.IsEmpty())
+ native_widget_->CenterWindow(size);
+ } else {
+ // Use the supplied initial bounds.
+ SetBoundsConstrained(bounds);
+ }
+}
+
bool Widget::GetSavedWindowPlacement(gfx::Rect* bounds,
ui::WindowShowState* show_state) {
// First we obtain the window's saved show-style and store it. We need to do
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698