| 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/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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "ui/base/cursor/cursor.h" | 11 #include "ui/base/cursor/cursor.h" |
| 12 #include "ui/base/default_theme_provider.h" | 12 #include "ui/base/default_theme_provider.h" |
| 13 #include "ui/base/hit_test.h" | 13 #include "ui/base/hit_test.h" |
| 14 #include "ui/base/ime/input_method.h" | 14 #include "ui/base/ime/input_method.h" |
| 15 #include "ui/base/l10n/l10n_font_util.h" | 15 #include "ui/base/l10n/l10n_font_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
| 18 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
| 19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 20 #include "ui/events/event_utils.h" | 20 #include "ui/events/event_utils.h" |
| 21 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
| 22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 23 #include "ui/views/controls/menu/menu_controller.h" | 23 #include "ui/views/controls/menu/menu_controller.h" |
| 24 #include "ui/views/event_monitor.h" |
| 24 #include "ui/views/focus/focus_manager.h" | 25 #include "ui/views/focus/focus_manager.h" |
| 25 #include "ui/views/focus/focus_manager_factory.h" | 26 #include "ui/views/focus/focus_manager_factory.h" |
| 26 #include "ui/views/focus/view_storage.h" | 27 #include "ui/views/focus/view_storage.h" |
| 27 #include "ui/views/focus/widget_focus_manager.h" | 28 #include "ui/views/focus/widget_focus_manager.h" |
| 28 #include "ui/views/views_delegate.h" | 29 #include "ui/views/views_delegate.h" |
| 29 #include "ui/views/widget/native_widget_private.h" | 30 #include "ui/views/widget/native_widget_private.h" |
| 30 #include "ui/views/widget/root_view.h" | 31 #include "ui/views/widget/root_view.h" |
| 31 #include "ui/views/widget/tooltip_manager.h" | 32 #include "ui/views/widget/tooltip_manager.h" |
| 32 #include "ui/views/widget/widget_delegate.h" | 33 #include "ui/views/widget/widget_delegate.h" |
| 33 #include "ui/views/widget/widget_deletion_observer.h" | 34 #include "ui/views/widget/widget_deletion_observer.h" |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 982 |
| 982 const TooltipManager* Widget::GetTooltipManager() const { | 983 const TooltipManager* Widget::GetTooltipManager() const { |
| 983 return native_widget_->GetTooltipManager(); | 984 return native_widget_->GetTooltipManager(); |
| 984 } | 985 } |
| 985 | 986 |
| 986 gfx::Rect Widget::GetWorkAreaBoundsInScreen() const { | 987 gfx::Rect Widget::GetWorkAreaBoundsInScreen() const { |
| 987 return native_widget_->GetWorkAreaBoundsInScreen(); | 988 return native_widget_->GetWorkAreaBoundsInScreen(); |
| 988 } | 989 } |
| 989 | 990 |
| 990 void Widget::SynthesizeMouseMoveEvent() { | 991 void Widget::SynthesizeMouseMoveEvent() { |
| 992 // In screen coordinate. |
| 993 gfx::Point mouse_location = EventMonitor::GetLastMouseLocation(); |
| 994 if (!GetWindowBoundsInScreen().Contains(mouse_location)) |
| 995 return; |
| 996 |
| 997 // Convert: screen coordinate -> widget coordinate. |
| 998 View::ConvertPointFromScreen(root_view_.get(), &mouse_location); |
| 991 last_mouse_event_was_move_ = false; | 999 last_mouse_event_was_move_ = false; |
| 992 ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, last_mouse_event_position_, | 1000 ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, mouse_location, |
| 993 last_mouse_event_position_, ui::EventTimeForNow(), | 1001 mouse_location, ui::EventTimeForNow(), |
| 994 ui::EF_IS_SYNTHESIZED, 0); | 1002 ui::EF_IS_SYNTHESIZED, 0); |
| 995 root_view_->OnMouseMoved(mouse_event); | 1003 root_view_->OnMouseMoved(mouse_event); |
| 996 } | 1004 } |
| 997 | 1005 |
| 998 void Widget::OnRootViewLayout() { | 1006 void Widget::OnRootViewLayout() { |
| 999 native_widget_->OnRootViewLayout(); | 1007 native_widget_->OnRootViewLayout(); |
| 1000 } | 1008 } |
| 1001 | 1009 |
| 1002 bool Widget::IsTranslucentWindowOpacitySupported() const { | 1010 bool Widget::IsTranslucentWindowOpacitySupported() const { |
| 1003 return native_widget_->IsTranslucentWindowOpacitySupported(); | 1011 return native_widget_->IsTranslucentWindowOpacitySupported(); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1491 |
| 1484 //////////////////////////////////////////////////////////////////////////////// | 1492 //////////////////////////////////////////////////////////////////////////////// |
| 1485 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1493 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1486 | 1494 |
| 1487 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1495 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1488 return this; | 1496 return this; |
| 1489 } | 1497 } |
| 1490 | 1498 |
| 1491 } // namespace internal | 1499 } // namespace internal |
| 1492 } // namespace views | 1500 } // namespace views |
| OLD | NEW |