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

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: Add support to create KeyboardOverlayDialog as a bordless dialog. 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
« chrome/browser/ui/views/window.h ('K') | « 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..799472779716bcd15b5ebac92516feb325fcd2c4 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -221,6 +221,25 @@ Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate,
}
// static
+Widget* Widget::CreateFramelessWindowWithParentAndBounds(
+ WidgetDelegate* delegate,
+ gfx::NativeWindow parent,
+ const gfx::Rect& bounds) {
Ben Goodger (Google) 2012/01/30 21:16:16 Rather than do this in Widget, can you just move t
jennyz 2012/01/30 23:13:28 Done.
+ Widget* widget = new Widget;
+ Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
+ params.delegate = delegate;
+ // Will this function be called if !defined(USE_AURA)?
+#if defined(OS_WIN) || defined(USE_AURA)
+ params.parent = parent;
+#endif
+ params.bounds = bounds;
+ widget->Init(params);
+ widget->SetContentsView(delegate->GetContentsView());
+ widget->SetInitialBoundsForFramelessWindow(bounds);
jennyz 2012/01/27 23:17:48 I was thinking for moving SetContentsView(delegate
+ return widget;
+}
+
+// static
void Widget::SetPureViews(bool pure) {
use_pure_views = pure;
}
@@ -1204,6 +1223,19 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
}
}
+void Widget::SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds) {
+ View* contents_view = GetContentsView();
+ DCHECK(contents_view != NULL);
+ 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
« chrome/browser/ui/views/window.h ('K') | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698