OLD | NEW |
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/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/activation_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 input_method->Init(GetWidget()); | 349 input_method->Init(GetWidget()); |
350 return input_method; | 350 return input_method; |
351 } | 351 } |
352 | 352 |
353 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { | 353 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { |
354 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); | 354 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); |
355 // When centering window, we take the intersection of the host and | 355 // When centering window, we take the intersection of the host and |
356 // the parent. We assume the root window represents the visible | 356 // the parent. We assume the root window represents the visible |
357 // rect of a single screen. | 357 // rect of a single screen. |
358 gfx::Rect work_area = | 358 gfx::Rect work_area = |
359 gfx::Screen::GetMonitorNearestWindow(window_).work_area(); | 359 gfx::Screen::GetDisplayNearestWindow(window_).work_area(); |
360 parent_bounds = parent_bounds.Intersect(work_area); | 360 parent_bounds = parent_bounds.Intersect(work_area); |
361 | 361 |
362 // If |window_|'s transient parent's bounds are big enough to fit it, then we | 362 // If |window_|'s transient parent's bounds are big enough to fit it, then we |
363 // center it with respect to the transient parent. | 363 // center it with respect to the transient parent. |
364 if (window_->transient_parent()) { | 364 if (window_->transient_parent()) { |
365 gfx::Rect transient_parent_rect = window_->transient_parent()-> | 365 gfx::Rect transient_parent_rect = window_->transient_parent()-> |
366 GetBoundsInRootWindow().Intersect(work_area); | 366 GetBoundsInRootWindow().Intersect(work_area); |
367 if (transient_parent_rect.height() >= size.height() && | 367 if (transient_parent_rect.height() >= size.height() && |
368 transient_parent_rect.width() >= size.width()) | 368 transient_parent_rect.width() >= size.width()) |
369 parent_bounds = transient_parent_rect; | 369 parent_bounds = transient_parent_rect; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (window_ && window_->GetFocusManager() && | 635 if (window_ && window_->GetFocusManager() && |
636 window_->Contains(window_->GetFocusManager()->GetFocusedWindow())) | 636 window_->Contains(window_->GetFocusManager()->GetFocusedWindow())) |
637 window_->GetFocusManager()->SetFocusedWindow(window_, NULL); | 637 window_->GetFocusManager()->SetFocusedWindow(window_, NULL); |
638 } | 638 } |
639 | 639 |
640 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { | 640 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { |
641 window_->GetFocusManager()->SetFocusedWindow(native_view, NULL); | 641 window_->GetFocusManager()->SetFocusedWindow(native_view, NULL); |
642 } | 642 } |
643 | 643 |
644 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { | 644 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
645 return gfx::Screen::GetMonitorNearestWindow(GetNativeView()).work_area(); | 645 return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area(); |
646 } | 646 } |
647 | 647 |
648 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { | 648 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { |
649 if (!value) | 649 if (!value) |
650 active_window_observer_.reset(); | 650 active_window_observer_.reset(); |
651 else | 651 else |
652 active_window_observer_.reset(new ActiveWindowObserver(this)); | 652 active_window_observer_.reset(new ActiveWindowObserver(this)); |
653 } | 653 } |
654 | 654 |
655 Widget::MoveLoopResult NativeWidgetAura::RunMoveLoop() { | 655 Widget::MoveLoopResult NativeWidgetAura::RunMoveLoop() { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 return aura::Env::GetInstance()->is_mouse_button_down(); | 1027 return aura::Env::GetInstance()->is_mouse_button_down(); |
1028 } | 1028 } |
1029 | 1029 |
1030 // static | 1030 // static |
1031 bool NativeWidgetPrivate::IsTouchDown() { | 1031 bool NativeWidgetPrivate::IsTouchDown() { |
1032 return aura::Env::GetInstance()->is_touch_down(); | 1032 return aura::Env::GetInstance()->is_touch_down(); |
1033 } | 1033 } |
1034 | 1034 |
1035 } // namespace internal | 1035 } // namespace internal |
1036 } // namespace views | 1036 } // namespace views |
OLD | NEW |