| 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_change_observer.h" | 9 #include "ui/aura/client/activation_change_observer.h" |
| 10 #include "ui/aura/client/activation_client.h" | 10 #include "ui/aura/client/activation_client.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 aura::RootWindow* root_window_; | 94 aura::RootWindow* root_window_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(ScopedFocusNotificationObserver); | 96 DISALLOW_COPY_AND_ASSIGN(ScopedFocusNotificationObserver); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class ScopedTargetFocusNotificationObserver : public FocusNotificationObserver { | 99 class ScopedTargetFocusNotificationObserver : public FocusNotificationObserver { |
| 100 public: | 100 public: |
| 101 ScopedTargetFocusNotificationObserver(aura::RootWindow* root_window, int id) | 101 ScopedTargetFocusNotificationObserver(aura::Window* root_window, int id) |
| 102 : target_(root_window->GetChildById(id)) { | 102 : target_(root_window->GetChildById(id)) { |
| 103 aura::client::SetActivationChangeObserver(target_, this); | 103 aura::client::SetActivationChangeObserver(target_, this); |
| 104 aura::client::SetFocusChangeObserver(target_, this); | 104 aura::client::SetFocusChangeObserver(target_, this); |
| 105 tracker_.Add(target_); | 105 tracker_.Add(target_); |
| 106 } | 106 } |
| 107 virtual ~ScopedTargetFocusNotificationObserver() { | 107 virtual ~ScopedTargetFocusNotificationObserver() { |
| 108 if (tracker_.Contains(target_)) { | 108 if (tracker_.Contains(target_)) { |
| 109 aura::client::SetActivationChangeObserver(target_, NULL); | 109 aura::client::SetActivationChangeObserver(target_, NULL); |
| 110 aura::client::SetFocusChangeObserver(target_, NULL); | 110 aura::client::SetFocusChangeObserver(target_, NULL); |
| 111 } | 111 } |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); | 1014 DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); |
| 1015 | 1015 |
| 1016 // Clicking on a window which has capture should not result in a focus change. | 1016 // Clicking on a window which has capture should not result in a focus change. |
| 1017 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); | 1017 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); |
| 1018 | 1018 |
| 1019 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, | 1019 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, |
| 1020 ChangeFocusWhenNothingFocusedAndCaptured); | 1020 ChangeFocusWhenNothingFocusedAndCaptured); |
| 1021 | 1021 |
| 1022 } // namespace corewm | 1022 } // namespace corewm |
| 1023 } // namespace views | 1023 } // namespace views |
| OLD | NEW |