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

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: Move CreateFramelessWindowWithParentAndBounds into window.cc 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..3e64731f6616d2eb05eeaafa3030e6f0371544ed 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -336,6 +336,11 @@ void Widget::Init(const InitParams& params) {
else if (params.show_state == ui::SHOW_STATE_MINIMIZED)
Minimize();
UpdateWindowTitle();
+ } else {
Ben Goodger (Google) 2012/01/31 00:14:19 } else if (params.delegate) {
jennyz 2012/01/31 00:24:03 Done.
+ if (params.delegate != NULL) {
+ SetContentsView(params.delegate->GetContentsView());
+ SetInitialBoundsForFramelessWindow(params.bounds);
+ }
}
native_widget_initialized_ = true;
}
@@ -406,6 +411,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 +1212,19 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
}
}
+void Widget::SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds) {
+ View* contents_view = GetContentsView();
+ DCHECK(contents_view != NULL);
mazda 2012/01/30 23:26:29 DCHECK(contents_view);
jennyz 2012/01/31 00:24:03 Done.
+ if (bounds.IsEmpty()) {
+ // No initial bounds supplied, so size the window to its content and
+ // center over its parent.
+ native_widget_->CenterWindow(contents_view->GetPreferredSize());
+ } 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