| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/focus_controller.h" | 5 #include "components/mus/ws/focus_controller.h" |
| 6 | 6 |
| 7 #include "components/mus/ws/focus_controller_delegate.h" | 7 #include "components/mus/ws/focus_controller_delegate.h" |
| 8 #include "components/mus/ws/server_window.h" | 8 #include "components/mus/ws/server_window.h" |
| 9 #include "components/mus/ws/test_server_window_delegate.h" | 9 #include "components/mus/ws/test_server_window_delegate.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 change_count_ = 0u; | 25 change_count_ = 0u; |
| 26 old_focused_window_ = nullptr; | 26 old_focused_window_ = nullptr; |
| 27 new_focused_window_ = nullptr; | 27 new_focused_window_ = nullptr; |
| 28 } | 28 } |
| 29 size_t change_count() const { return change_count_; } | 29 size_t change_count() const { return change_count_; } |
| 30 ServerWindow* old_focused_window() { return old_focused_window_; } | 30 ServerWindow* old_focused_window() { return old_focused_window_; } |
| 31 ServerWindow* new_focused_window() { return new_focused_window_; } | 31 ServerWindow* new_focused_window() { return new_focused_window_; } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // FocusControllerDelegate: | 34 // FocusControllerDelegate: |
| 35 bool CanHaveActiveChildren(ServerWindow* window) const override { |
| 36 return true; |
| 37 } |
| 38 void OnActivationChanged(ServerWindow* old_active_window, |
| 39 ServerWindow* new_active_window) override {} |
| 35 void OnFocusChanged(ServerWindow* old_focused_window, | 40 void OnFocusChanged(ServerWindow* old_focused_window, |
| 36 ServerWindow* new_focused_window) override { | 41 ServerWindow* new_focused_window) override { |
| 37 change_count_++; | 42 change_count_++; |
| 38 old_focused_window_ = old_focused_window; | 43 old_focused_window_ = old_focused_window; |
| 39 new_focused_window_ = new_focused_window; | 44 new_focused_window_ = new_focused_window; |
| 40 } | 45 } |
| 41 | 46 |
| 42 size_t change_count_; | 47 size_t change_count_; |
| 43 ServerWindow* old_focused_window_; | 48 ServerWindow* old_focused_window_; |
| 44 ServerWindow* new_focused_window_; | 49 ServerWindow* new_focused_window_; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 child.SetVisible(false); | 107 child.SetVisible(false); |
| 103 EXPECT_EQ(1u, focus_delegate.change_count()); | 108 EXPECT_EQ(1u, focus_delegate.change_count()); |
| 104 EXPECT_EQ(&root, focus_delegate.new_focused_window()); | 109 EXPECT_EQ(&root, focus_delegate.new_focused_window()); |
| 105 EXPECT_EQ(&child_child, focus_delegate.old_focused_window()); | 110 EXPECT_EQ(&child_child, focus_delegate.old_focused_window()); |
| 106 focus_delegate.ClearAll(); | 111 focus_delegate.ClearAll(); |
| 107 } | 112 } |
| 108 | 113 |
| 109 } // namespace ws | 114 } // namespace ws |
| 110 | 115 |
| 111 } // namespace mus | 116 } // namespace mus |
| OLD | NEW |