Chromium Code Reviews| 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; | |
| 20 class FocusSynchronizerDelegate; | 21 class FocusSynchronizerDelegate; |
| 21 class WindowMus; | 22 class WindowMus; |
| 22 | 23 |
| 23 namespace client { | 24 namespace client { |
| 24 class FocusClient; | 25 class FocusClient; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // FocusSynchronizer is resonsible for keeping focus in sync between aura | 28 // FocusSynchronizer is resonsible for keeping focus in sync between aura |
| 28 // and the mus server. | 29 // and the mus server. |
| 29 class FocusSynchronizer : public client::FocusChangeObserver, | 30 class FocusSynchronizer : public client::FocusChangeObserver, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 45 void SetActiveFocusClient(client::FocusClient* focus_client); | 46 void SetActiveFocusClient(client::FocusClient* focus_client); |
| 46 | 47 |
| 47 // Called internally to set |focused_window_| and update the server. | 48 // Called internally to set |focused_window_| and update the server. |
| 48 void SetFocusedWindow(WindowMus* window); | 49 void SetFocusedWindow(WindowMus* window); |
| 49 | 50 |
| 50 // Overriden from client::FocusChangeObserver: | 51 // Overriden from client::FocusChangeObserver: |
| 51 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override; | 52 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override; |
| 52 | 53 |
| 53 // Overrided from EnvObserver: | 54 // Overrided from EnvObserver: |
| 54 void OnWindowInitialized(Window* window) override; | 55 void OnWindowInitialized(Window* window) override; |
| 56 void OnWillDestroyEnv() override; | |
| 55 void OnActiveFocusClientChanged(client::FocusClient* focus_client, | 57 void OnActiveFocusClientChanged(client::FocusClient* focus_client, |
| 56 Window* window) override; | 58 Window* window) override; |
| 57 | 59 |
| 58 FocusSynchronizerDelegate* delegate_; | 60 FocusSynchronizerDelegate* delegate_; |
| 59 ui::mojom::WindowTree* window_tree_; | 61 ui::mojom::WindowTree* window_tree_; |
| 60 | 62 |
| 61 client::FocusClient* active_focus_client_ = nullptr; | 63 client::FocusClient* active_focus_client_ = nullptr; |
| 62 | 64 |
| 63 bool setting_focus_ = false; | 65 bool setting_focus_ = false; |
| 64 WindowMus* window_setting_focus_to_ = nullptr; | 66 WindowMus* window_setting_focus_to_ = nullptr; |
| 65 WindowMus* focused_window_ = nullptr; | 67 WindowMus* focused_window_ = nullptr; |
| 66 | 68 |
| 69 // Cached so we can detect if Env is destroyed before us. | |
|
sadrul
2016/12/16 02:17:48
When does this happen?
sky
2016/12/16 03:51:50
It appears content destroys Env before the WindowT
| |
| 70 Env* env_; | |
| 71 | |
| 67 DISALLOW_COPY_AND_ASSIGN(FocusSynchronizer); | 72 DISALLOW_COPY_AND_ASSIGN(FocusSynchronizer); |
| 68 }; | 73 }; |
| 69 | 74 |
| 70 } // namespace aura | 75 } // namespace aura |
| 71 | 76 |
| 72 #endif // UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ | 77 #endif // UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_ |
| OLD | NEW |