OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/views/test/test_views.h" | 5 #include "ui/views/test/test_views.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/views/widget/native_widget_private.h" | 8 #include "ui/views/widget/native_widget_private.h" |
9 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 | 12 |
13 StaticSizedView::StaticSizedView(const gfx::Size& size) | 13 StaticSizedView::StaticSizedView(const gfx::Size& preferred_size) |
14 // Default GetMinimumSize() is GetPreferredSize(). Default GetMaximumSize() | 14 // Default GetMinimumSize() is GetPreferredSize(). Default GetMaximumSize() |
15 // is 0x0. | 15 // is 0x0. |
16 : size_(size), | 16 : preferred_size_(preferred_size), |
17 minimum_size_(size) { | 17 minimum_size_(preferred_size) {} |
18 } | |
19 | 18 |
20 StaticSizedView::~StaticSizedView() {} | 19 StaticSizedView::~StaticSizedView() {} |
21 | 20 |
22 gfx::Size StaticSizedView::GetPreferredSize() const { | 21 gfx::Size StaticSizedView::GetPreferredSize() const { |
23 return size_; | 22 return preferred_size_; |
24 } | 23 } |
25 | 24 |
26 gfx::Size StaticSizedView::GetMinimumSize() const { | 25 gfx::Size StaticSizedView::GetMinimumSize() const { |
27 return minimum_size_; | 26 return minimum_size_; |
28 } | 27 } |
29 | 28 |
30 gfx::Size StaticSizedView::GetMaximumSize() const { | 29 gfx::Size StaticSizedView::GetMaximumSize() const { |
31 return maximum_size_; | 30 return maximum_size_; |
32 } | 31 } |
33 | 32 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 99 } |
101 | 100 |
102 void EventCountView::RecordEvent(ui::Event* event) { | 101 void EventCountView::RecordEvent(ui::Event* event) { |
103 ++event_count_[event->type()]; | 102 ++event_count_[event->type()]; |
104 last_flags_ = event->flags(); | 103 last_flags_ = event->flags(); |
105 if (handle_mode_ == CONSUME_EVENTS) | 104 if (handle_mode_ == CONSUME_EVENTS) |
106 event->SetHandled(); | 105 event->SetHandled(); |
107 } | 106 } |
108 | 107 |
109 } // namespace views | 108 } // namespace views |
OLD | NEW |