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

Side by Side Diff: ui/views/widget/widget.cc

Issue 12342028: make menus, bubbles, etc. top level windows on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 7 years, 9 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 | Annotate | Revision Log
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 "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 void Widget::Init(const InitParams& in_params) { 340 void Widget::Init(const InitParams& in_params) {
341 TRACE_EVENT0("views", "Widget::Init"); 341 TRACE_EVENT0("views", "Widget::Init");
342 InitParams params = in_params; 342 InitParams params = in_params;
343 343
344 is_top_level_ = params.top_level || 344 is_top_level_ = params.top_level ||
345 (!params.child && 345 (!params.child &&
346 params.type != InitParams::TYPE_CONTROL && 346 params.type != InitParams::TYPE_CONTROL &&
347 params.type != InitParams::TYPE_TOOLTIP); 347 params.type != InitParams::TYPE_TOOLTIP);
348 params.top_level = is_top_level_; 348 params.top_level = is_top_level_;
349 #if defined(OS_WIN) && defined(USE_AURA)
350 // It'll need to be faded in if it's top level and not the main window.
351 params.transparent = is_top_level_ && params.type != InitParams::TYPE_WINDOW;
352 #endif
349 353
350 if (ViewsDelegate::views_delegate) 354 if (ViewsDelegate::views_delegate)
351 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this); 355 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this);
352 356
353 widget_delegate_ = params.delegate ? 357 widget_delegate_ = params.delegate ?
354 params.delegate : new DefaultWidgetDelegate(this, params); 358 params.delegate : new DefaultWidgetDelegate(this, params);
355 ownership_ = params.ownership; 359 ownership_ = params.ownership;
356 native_widget_ = CreateNativeWidget(params.native_widget, this)-> 360 native_widget_ = CreateNativeWidget(params.native_widget, this)->
357 AsNativeWidgetPrivate(); 361 AsNativeWidgetPrivate();
358 root_view_.reset(CreateRootView()); 362 root_view_.reset(CreateRootView());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 root_view_->SetContentsView(view); 458 root_view_->SetContentsView(view);
455 if (non_client_view_ != view) { 459 if (non_client_view_ != view) {
456 // |non_client_view_| can only be non-NULL here if RequiresNonClientView() 460 // |non_client_view_| can only be non-NULL here if RequiresNonClientView()
457 // was true when the widget was initialized. Creating widgets with non 461 // was true when the widget was initialized. Creating widgets with non
458 // client views and then setting the contents view can cause subtle 462 // client views and then setting the contents view can cause subtle
459 // problems on Windows, where the native widget thinks there is still a 463 // problems on Windows, where the native widget thinks there is still a
460 // |non_client_view_|. If you get this error, either use a different type 464 // |non_client_view_|. If you get this error, either use a different type
461 // when initializing the widget, or don't call SetContentsView(). 465 // when initializing the widget, or don't call SetContentsView().
462 DCHECK(!non_client_view_); 466 DCHECK(!non_client_view_);
463 non_client_view_ = NULL; 467 non_client_view_ = NULL;
464 } 468 }
scottmg 2013/03/14 22:51:53 (due to rebase, not this CL)
465 } 469 }
466 470
467 View* Widget::GetContentsView() { 471 View* Widget::GetContentsView() {
468 return root_view_->GetContentsView(); 472 return root_view_->GetContentsView();
469 } 473 }
470 474
471 gfx::Rect Widget::GetWindowBoundsInScreen() const { 475 gfx::Rect Widget::GetWindowBoundsInScreen() const {
472 return native_widget_->GetWindowBoundsInScreen(); 476 return native_widget_->GetWindowBoundsInScreen();
473 } 477 }
474 478
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1425
1422 //////////////////////////////////////////////////////////////////////////////// 1426 ////////////////////////////////////////////////////////////////////////////////
1423 // internal::NativeWidgetPrivate, NativeWidget implementation: 1427 // internal::NativeWidgetPrivate, NativeWidget implementation:
1424 1428
1425 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1429 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1426 return this; 1430 return this;
1427 } 1431 }
1428 1432
1429 } // namespace internal 1433 } // namespace internal
1430 } // namespace views 1434 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698