Chromium Code Reviews| 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" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 ownership_(InitParams::NATIVE_WIDGET_OWNS_WIDGET), | 162 ownership_(InitParams::NATIVE_WIDGET_OWNS_WIDGET), |
| 163 is_secondary_widget_(true), | 163 is_secondary_widget_(true), |
| 164 frame_type_(FRAME_TYPE_DEFAULT), | 164 frame_type_(FRAME_TYPE_DEFAULT), |
| 165 disable_inactive_rendering_(false), | 165 disable_inactive_rendering_(false), |
| 166 widget_closed_(false), | 166 widget_closed_(false), |
| 167 saved_show_state_(ui::SHOW_STATE_DEFAULT), | 167 saved_show_state_(ui::SHOW_STATE_DEFAULT), |
| 168 focus_on_creation_(true), | 168 focus_on_creation_(true), |
| 169 is_top_level_(false), | 169 is_top_level_(false), |
| 170 native_widget_initialized_(false), | 170 native_widget_initialized_(false), |
| 171 native_widget_destroyed_(false), | 171 native_widget_destroyed_(false), |
| 172 is_mouse_on_widget_(false), | |
| 172 is_mouse_button_pressed_(false), | 173 is_mouse_button_pressed_(false), |
| 173 ignore_capture_loss_(false), | 174 ignore_capture_loss_(false), |
| 174 last_mouse_event_was_move_(false), | 175 last_mouse_event_was_move_(false), |
| 175 auto_release_capture_(true), | 176 auto_release_capture_(true), |
| 176 root_layers_dirty_(false), | 177 root_layers_dirty_(false), |
| 177 movement_disabled_(false), | 178 movement_disabled_(false), |
| 178 observer_manager_(this) { | 179 observer_manager_(this) { |
| 179 } | 180 } |
| 180 | 181 |
| 181 Widget::~Widget() { | 182 Widget::~Widget() { |
| (...skipping 799 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 if (!is_mouse_on_widget_) | |
| 993 return; | |
| 994 | |
| 991 last_mouse_event_was_move_ = false; | 995 last_mouse_event_was_move_ = false; |
| 992 ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, last_mouse_event_position_, | 996 ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, last_mouse_event_position_, |
| 993 last_mouse_event_position_, ui::EventTimeForNow(), | 997 last_mouse_event_position_, ui::EventTimeForNow(), |
| 994 ui::EF_IS_SYNTHESIZED, 0); | 998 ui::EF_IS_SYNTHESIZED, 0); |
| 995 root_view_->OnMouseMoved(mouse_event); | 999 root_view_->OnMouseMoved(mouse_event); |
| 996 } | 1000 } |
| 997 | 1001 |
| 998 void Widget::OnRootViewLayout() { | 1002 void Widget::OnRootViewLayout() { |
| 999 native_widget_->OnRootViewLayout(); | 1003 native_widget_->OnRootViewLayout(); |
| 1000 } | 1004 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1223 root_view->OnMouseDragged(*event); | 1227 root_view->OnMouseDragged(*event); |
| 1224 } else if (!last_mouse_event_was_move_ || | 1228 } else if (!last_mouse_event_was_move_ || |
| 1225 last_mouse_event_position_ != event->location()) { | 1229 last_mouse_event_position_ != event->location()) { |
| 1226 last_mouse_event_position_ = event->location(); | 1230 last_mouse_event_position_ = event->location(); |
| 1227 last_mouse_event_was_move_ = true; | 1231 last_mouse_event_was_move_ = true; |
| 1228 if (root_view) | 1232 if (root_view) |
| 1229 root_view->OnMouseMoved(*event); | 1233 root_view->OnMouseMoved(*event); |
| 1230 } | 1234 } |
| 1231 return; | 1235 return; |
| 1232 | 1236 |
| 1237 case ui::ET_MOUSE_ENTERED: | |
| 1238 is_mouse_on_widget_ = true; | |
| 1239 return; | |
| 1240 | |
| 1233 case ui::ET_MOUSE_EXITED: | 1241 case ui::ET_MOUSE_EXITED: |
| 1242 is_mouse_on_widget_ = false; | |
|
sky
2015/08/20 18:03:12
I'm worried we won't always get here. Say you clic
oshima
2015/08/21 01:00:15
For drag case, the mouse location is outside of th
| |
| 1234 last_mouse_event_was_move_ = false; | 1243 last_mouse_event_was_move_ = false; |
| 1235 if (root_view) | 1244 if (root_view) |
| 1236 root_view->OnMouseExited(*event); | 1245 root_view->OnMouseExited(*event); |
| 1237 return; | 1246 return; |
| 1238 | 1247 |
| 1239 case ui::ET_MOUSEWHEEL: | 1248 case ui::ET_MOUSEWHEEL: |
| 1240 if (root_view && root_view->OnMouseWheel( | 1249 if (root_view && root_view->OnMouseWheel( |
| 1241 static_cast<const ui::MouseWheelEvent&>(*event))) | 1250 static_cast<const ui::MouseWheelEvent&>(*event))) |
| 1242 event->SetHandled(); | 1251 event->SetHandled(); |
| 1243 return; | 1252 return; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 | 1492 |
| 1484 //////////////////////////////////////////////////////////////////////////////// | 1493 //////////////////////////////////////////////////////////////////////////////// |
| 1485 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1494 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1486 | 1495 |
| 1487 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1496 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1488 return this; | 1497 return this; |
| 1489 } | 1498 } |
| 1490 | 1499 |
| 1491 } // namespace internal | 1500 } // namespace internal |
| 1492 } // namespace views | 1501 } // namespace views |
| OLD | NEW |