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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac compile fix Created 8 years, 2 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/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/events/event.h" 10 #include "ui/base/events/event.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 NativeWidget* CreateNativeWidget(NativeWidget* native_widget, 55 NativeWidget* CreateNativeWidget(NativeWidget* native_widget,
56 internal::NativeWidgetDelegate* delegate, 56 internal::NativeWidgetDelegate* delegate,
57 gfx::NativeView parent) { 57 gfx::NativeView parent) {
58 if (!native_widget) { 58 if (!native_widget) {
59 if (ViewsDelegate::views_delegate) { 59 if (ViewsDelegate::views_delegate) {
60 native_widget = 60 native_widget =
61 ViewsDelegate::views_delegate->CreateNativeWidget(delegate, parent); 61 ViewsDelegate::views_delegate->CreateNativeWidget(delegate, parent);
62 } 62 }
63 if (!native_widget) { 63 if (!native_widget) {
64 native_widget = 64 native_widget =
65 internal::NativeWidgetPrivate::CreateNativeWidget(delegate); 65 internal::NativeWidgetPrivate::CreateNativeWidget(delegate, parent);
66 } 66 }
67 } 67 }
68 return native_widget; 68 return native_widget;
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 // This class is used to keep track of the event a Widget is processing, and 73 // This class is used to keep track of the event a Widget is processing, and
74 // restore any previously active event afterwards. 74 // restore any previously active event afterwards.
75 class ScopedEvent { 75 class ScopedEvent {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 void Widget::SetSize(const gfx::Size& size) { 459 void Widget::SetSize(const gfx::Size& size) {
460 native_widget_->SetSize(size); 460 native_widget_->SetSize(size);
461 } 461 }
462 462
463 void Widget::CenterWindow(const gfx::Size& size) { 463 void Widget::CenterWindow(const gfx::Size& size) {
464 native_widget_->CenterWindow(size); 464 native_widget_->CenterWindow(size);
465 } 465 }
466 466
467 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { 467 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) {
468 gfx::Rect work_area = 468 gfx::Rect work_area =
469 gfx::Screen::GetDisplayNearestPoint(bounds.origin()).work_area(); 469 gfx::Screen::GetDisplayNearestPoint(
470 gfx::Screen::BadTwoWorldsContext(), bounds.origin()).work_area();
470 if (work_area.IsEmpty()) { 471 if (work_area.IsEmpty()) {
471 SetBounds(bounds); 472 SetBounds(bounds);
472 } else { 473 } else {
473 // Inset the work area slightly. 474 // Inset the work area slightly.
474 work_area.Inset(10, 10, 10, 10); 475 work_area.Inset(10, 10, 10, 10);
475 SetBounds(work_area.AdjustToFit(bounds)); 476 SetBounds(work_area.AdjustToFit(bounds));
476 } 477 }
477 } 478 }
478 479
479 void Widget::SetVisibilityChangedAnimationsEnabled(bool value) { 480 void Widget::SetVisibilityChangedAnimationsEnabled(bool value) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 1348
1348 //////////////////////////////////////////////////////////////////////////////// 1349 ////////////////////////////////////////////////////////////////////////////////
1349 // internal::NativeWidgetPrivate, NativeWidget implementation: 1350 // internal::NativeWidgetPrivate, NativeWidget implementation:
1350 1351
1351 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1352 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1352 return this; 1353 return this;
1353 } 1354 }
1354 1355
1355 } // namespace internal 1356 } // namespace internal
1356 } // namespace views 1357 } // namespace views
OLDNEW
« ui/gfx/screen_type_delegate.h ('K') | « ui/views/widget/tooltip_manager_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698