| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "ui/gfx/native_widget_types.h" | 8 #include "ui/gfx/native_widget_types.h" |
| 9 #include "ui/views/test/widget_test.h" | 9 #include "ui/views/test/widget_test.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 MouseEventTrackingWidget() : got_mouse_event_(false) {} | 673 MouseEventTrackingWidget() : got_mouse_event_(false) {} |
| 674 virtual ~MouseEventTrackingWidget() {} | 674 virtual ~MouseEventTrackingWidget() {} |
| 675 | 675 |
| 676 bool GetAndClearGotMouseEvent() { | 676 bool GetAndClearGotMouseEvent() { |
| 677 bool value = got_mouse_event_; | 677 bool value = got_mouse_event_; |
| 678 got_mouse_event_ = false; | 678 got_mouse_event_ = false; |
| 679 return value; | 679 return value; |
| 680 } | 680 } |
| 681 | 681 |
| 682 // Widget: | 682 // Widget: |
| 683 virtual void OnMouseEvent(ui::MouseEvent* event) { | 683 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
| 684 got_mouse_event_ = true; | 684 got_mouse_event_ = true; |
| 685 Widget::OnMouseEvent(event); | 685 Widget::OnMouseEvent(event); |
| 686 } | 686 } |
| 687 | 687 |
| 688 private: | 688 private: |
| 689 bool got_mouse_event_; | 689 bool got_mouse_event_; |
| 690 | 690 |
| 691 DISALLOW_COPY_AND_ASSIGN(MouseEventTrackingWidget); | 691 DISALLOW_COPY_AND_ASSIGN(MouseEventTrackingWidget); |
| 692 }; | 692 }; |
| 693 | 693 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 static_cast<aura::RootWindowHostDelegate*>( | 726 static_cast<aura::RootWindowHostDelegate*>( |
| 727 widget1.GetNativeWindow()->GetRootWindow())->OnHostMouseEvent( | 727 widget1.GetNativeWindow()->GetRootWindow())->OnHostMouseEvent( |
| 728 &mouse_event); | 728 &mouse_event); |
| 729 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 729 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
| 730 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 730 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
| 731 } | 731 } |
| 732 #endif | 732 #endif |
| 733 | 733 |
| 734 } // namespace test | 734 } // namespace test |
| 735 } // namespace views | 735 } // namespace views |
| OLD | NEW |