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/corewm/focus_controller.h" | 5 #include "ui/views/corewm/focus_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 void set_result(ui::EventResult result) { result_ = result; } | 36 void set_result(ui::EventResult result) { result_ = result; } |
37 | 37 |
38 int GetCountForEventType(int event_type) { | 38 int GetCountForEventType(int event_type) { |
39 std::map<int, int>::const_iterator it = event_counts_.find(event_type); | 39 std::map<int, int>::const_iterator it = event_counts_.find(event_type); |
40 return it != event_counts_.end() ? it->second : 0; | 40 return it != event_counts_.end() ? it->second : 0; |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 // Overridden from ui::EventHandler: | 44 // Overridden from ui::EventHandler: |
45 virtual ui::EventResult OnEvent(ui::Event* event) OVERRIDE { | 45 virtual void OnEvent(ui::Event* event) OVERRIDE { |
46 event_counts_[event->type()] += 1; | 46 event_counts_[event->type()] += 1; |
47 return result_; | 47 if (result_ & ui::ER_CONSUMED) |
| 48 event->StopPropagation(); |
| 49 else if (result_ & ui::ER_HANDLED) |
| 50 event->SetHandled(); |
48 } | 51 } |
49 | 52 |
50 // Overridden from aura::WindowObserver: | 53 // Overridden from aura::WindowObserver: |
51 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { | 54 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { |
52 DCHECK_EQ(window, window_); | 55 DCHECK_EQ(window, window_); |
53 RemoveObserver(); | 56 RemoveObserver(); |
54 } | 57 } |
55 | 58 |
56 void RemoveObserver() { | 59 void RemoveObserver() { |
57 if (window_) { | 60 if (window_) { |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusToChildOfInactiveWindow); | 732 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusToChildOfInactiveWindow); |
730 | 733 |
731 // - Verifies that FocusRules determine what can be focused. | 734 // - Verifies that FocusRules determine what can be focused. |
732 ALL_FOCUS_TESTS(FocusRulesOverride); | 735 ALL_FOCUS_TESTS(FocusRulesOverride); |
733 | 736 |
734 // - Verifies that FocusRules determine what can be activated. | 737 // - Verifies that FocusRules determine what can be activated. |
735 TARGET_FOCUS_TESTS(ActivationRulesOverride); | 738 TARGET_FOCUS_TESTS(ActivationRulesOverride); |
736 | 739 |
737 } // namespace corewm | 740 } // namespace corewm |
738 } // namespace views | 741 } // namespace views |
OLD | NEW |