| 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->PreventDefault(); |
| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusToChildOfInactiveWindow); | 728 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusToChildOfInactiveWindow); |
| 726 | 729 |
| 727 // - Verifies that FocusRules determine what can be focused. | 730 // - Verifies that FocusRules determine what can be focused. |
| 728 ALL_FOCUS_TESTS(FocusRulesOverride); | 731 ALL_FOCUS_TESTS(FocusRulesOverride); |
| 729 | 732 |
| 730 // - Verifies that FocusRules determine what can be activated. | 733 // - Verifies that FocusRules determine what can be activated. |
| 731 TARGET_FOCUS_TESTS(ActivationRulesOverride); | 734 TARGET_FOCUS_TESTS(ActivationRulesOverride); |
| 732 | 735 |
| 733 } // namespace corewm | 736 } // namespace corewm |
| 734 } // namespace views | 737 } // namespace views |
| OLD | NEW |