Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: components/exo/wm_helper_mus.cc

Issue 2714763002: Change FocusSynchronizer to maintain active focus client and window. (Closed)
Patch Set: test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/wm_helper_mus.h ('k') | ui/aura/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/exo/wm_helper_mus.h" 5 #include "components/exo/wm_helper_mus.h"
6 6
7 #include "ui/aura/client/focus_client.h" 7 #include "ui/aura/client/focus_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/mus/focus_synchronizer.h"
10 #include "ui/aura/mus/window_tree_client.h"
9 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
10 #include "ui/display/manager/managed_display_info.h" 12 #include "ui/display/manager/managed_display_info.h"
13 #include "ui/views/mus/mus_client.h"
11 #include "ui/wm/public/activation_client.h" 14 #include "ui/wm/public/activation_client.h"
12 namespace exo { 15 namespace exo {
13 16
14 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
15 // WMHelperMus, public: 18 // WMHelperMus, public:
16 19
17 WMHelperMus::WMHelperMus() { 20 WMHelperMus::WMHelperMus() {
18 aura::Env* env = aura::Env::GetInstance(); 21 aura::FocusSynchronizer* focus_synchronizer =
19 SetActiveFocusClient(env->active_focus_client(), 22 views::MusClient::Get()->window_tree_client()->focus_synchronizer();
20 env->active_focus_client_root()); 23 SetActiveFocusClient(focus_synchronizer->active_focus_client(),
21 env->AddObserver(this); 24 focus_synchronizer->active_focus_client_root());
25 focus_synchronizer->AddObserver(this);
22 } 26 }
23 27
24 WMHelperMus::~WMHelperMus() { 28 WMHelperMus::~WMHelperMus() {
25 if (active_focus_client_) 29 if (active_focus_client_)
26 active_focus_client_->RemoveObserver(this); 30 active_focus_client_->RemoveObserver(this);
27 aura::Env::GetInstance()->RemoveObserver(this); 31 views::MusClient::Get()
32 ->window_tree_client()
33 ->focus_synchronizer()
34 ->RemoveObserver(this);
28 } 35 }
29 36
30 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
31 // WMHelperMus, private: 38 // WMHelperMus, private:
32 39
33 const display::ManagedDisplayInfo WMHelperMus::GetDisplayInfo( 40 const display::ManagedDisplayInfo WMHelperMus::GetDisplayInfo(
34 int64_t display_id) const { 41 int64_t display_id) const {
35 // TODO(penghuang): Return real display info when it is supported in mus. 42 // TODO(penghuang): Return real display info when it is supported in mus.
36 return display::ManagedDisplayInfo(display_id, "", false); 43 return display::ManagedDisplayInfo(display_id, "", false);
37 } 44 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 88
82 bool WMHelperMus::IsSpokenFeedbackEnabled() const { 89 bool WMHelperMus::IsSpokenFeedbackEnabled() const {
83 NOTIMPLEMENTED(); 90 NOTIMPLEMENTED();
84 return false; 91 return false;
85 } 92 }
86 93
87 void WMHelperMus::PlayEarcon(int sound_key) const { 94 void WMHelperMus::PlayEarcon(int sound_key) const {
88 NOTIMPLEMENTED(); 95 NOTIMPLEMENTED();
89 } 96 }
90 97
91 void WMHelperMus::OnWindowInitialized(aura::Window* window) {}
92
93 void WMHelperMus::OnActiveFocusClientChanged( 98 void WMHelperMus::OnActiveFocusClientChanged(
94 aura::client::FocusClient* focus_client, 99 aura::client::FocusClient* focus_client,
95 aura::Window* window) { 100 aura::Window* focus_client_root) {
96 SetActiveFocusClient(focus_client, window); 101 SetActiveFocusClient(focus_client, focus_client_root);
97 } 102 }
98 103
99 void WMHelperMus::OnWindowFocused(aura::Window* gained_focus, 104 void WMHelperMus::OnWindowFocused(aura::Window* gained_focus,
100 aura::Window* lost_focus) { 105 aura::Window* lost_focus) {
101 if (focused_window_ == gained_focus) 106 if (focused_window_ == gained_focus)
102 return; 107 return;
103 108
104 SetActiveWindow(GetActivationClient()->GetActiveWindow()); 109 SetActiveWindow(GetActivationClient()->GetActiveWindow());
105 SetFocusedWindow(gained_focus); 110 SetFocusedWindow(gained_focus);
106 } 111 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 NotifyWindowFocused(focused_window_, lost_focus); 148 NotifyWindowFocused(focused_window_, lost_focus);
144 } 149 }
145 150
146 aura::client::ActivationClient* WMHelperMus::GetActivationClient() { 151 aura::client::ActivationClient* WMHelperMus::GetActivationClient() {
147 return root_with_active_focus_client_ 152 return root_with_active_focus_client_
148 ? aura::client::GetActivationClient(root_with_active_focus_client_) 153 ? aura::client::GetActivationClient(root_with_active_focus_client_)
149 : nullptr; 154 : nullptr;
150 } 155 }
151 156
152 } // namespace exo 157 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/wm_helper_mus.h ('k') | ui/aura/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698