| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ | 5 #ifndef UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ |
| 6 #define UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ | 6 #define UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/aura/client/focus_change_observer.h" | 9 #include "ui/aura/client/focus_change_observer.h" |
| 10 #include "ui/aura/env_observer.h" | 10 #include "ui/aura/env_observer.h" |
| 11 | 11 |
| 12 namespace ui { | 12 namespace ui { |
| 13 namespace mojom { | 13 namespace mojom { |
| 14 class WindowTree; | 14 class WindowTree; |
| 15 } | 15 } |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 | 19 |
| 20 class Env; | |
| 21 class FocusSynchronizerDelegate; | 20 class FocusSynchronizerDelegate; |
| 22 class WindowMus; | 21 class WindowMus; |
| 23 | 22 |
| 24 namespace client { | 23 namespace client { |
| 25 class FocusClient; | 24 class FocusClient; |
| 26 } | 25 } |
| 27 | 26 |
| 28 // FocusSynchronizer is resonsible for keeping focus in sync between aura | 27 // FocusSynchronizer is resonsible for keeping focus in sync between aura |
| 29 // and the mus server. | 28 // and the mus server. |
| 30 class FocusSynchronizer : public client::FocusChangeObserver, | 29 class FocusSynchronizer : public client::FocusChangeObserver, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 void SetActiveFocusClient(client::FocusClient* focus_client); | 45 void SetActiveFocusClient(client::FocusClient* focus_client); |
| 47 | 46 |
| 48 // Called internally to set |focused_window_| and update the server. | 47 // Called internally to set |focused_window_| and update the server. |
| 49 void SetFocusedWindow(WindowMus* window); | 48 void SetFocusedWindow(WindowMus* window); |
| 50 | 49 |
| 51 // Overriden from client::FocusChangeObserver: | 50 // Overriden from client::FocusChangeObserver: |
| 52 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override; | 51 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override; |
| 53 | 52 |
| 54 // Overrided from EnvObserver: | 53 // Overrided from EnvObserver: |
| 55 void OnWindowInitialized(Window* window) override; | 54 void OnWindowInitialized(Window* window) override; |
| 56 void OnWillDestroyEnv() override; | |
| 57 void OnActiveFocusClientChanged(client::FocusClient* focus_client, | 55 void OnActiveFocusClientChanged(client::FocusClient* focus_client, |
| 58 Window* window) override; | 56 Window* window) override; |
| 59 | 57 |
| 60 FocusSynchronizerDelegate* delegate_; | 58 FocusSynchronizerDelegate* delegate_; |
| 61 ui::mojom::WindowTree* window_tree_; | 59 ui::mojom::WindowTree* window_tree_; |
| 62 | 60 |
| 63 client::FocusClient* active_focus_client_ = nullptr; | 61 client::FocusClient* active_focus_client_ = nullptr; |
| 64 | 62 |
| 65 bool setting_focus_ = false; | 63 bool setting_focus_ = false; |
| 66 WindowMus* window_setting_focus_to_ = nullptr; | 64 WindowMus* window_setting_focus_to_ = nullptr; |
| 67 WindowMus* focused_window_ = nullptr; | 65 WindowMus* focused_window_ = nullptr; |
| 68 | 66 |
| 69 // Cached so we can detect if Env is destroyed before us. | |
| 70 Env* env_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(FocusSynchronizer); | 67 DISALLOW_COPY_AND_ASSIGN(FocusSynchronizer); |
| 73 }; | 68 }; |
| 74 | 69 |
| 75 } // namespace aura | 70 } // namespace aura |
| 76 | 71 |
| 77 #endif // UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ | 72 #endif // UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ |
| OLD | NEW |