| 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 #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" | 9 #include "ui/aura/mus/focus_synchronizer.h" |
| 10 #include "ui/aura/mus/window_tree_client.h" | 10 #include "ui/aura/mus/window_tree_client.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #include "ui/display/display.h" |
| 12 #include "ui/display/manager/managed_display_info.h" | 13 #include "ui/display/manager/managed_display_info.h" |
| 13 #include "ui/views/mus/mus_client.h" | 14 #include "ui/views/mus/mus_client.h" |
| 14 #include "ui/wm/public/activation_client.h" | 15 #include "ui/wm/public/activation_client.h" |
| 15 namespace exo { | 16 namespace exo { |
| 16 | 17 |
| 17 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
| 18 // WMHelperMus, public: | 19 // WMHelperMus, public: |
| 19 | 20 |
| 20 WMHelperMus::WMHelperMus() { | 21 WMHelperMus::WMHelperMus() { |
| 21 aura::FocusSynchronizer* focus_synchronizer = | 22 aura::FocusSynchronizer* focus_synchronizer = |
| 22 views::MusClient::Get()->window_tree_client()->focus_synchronizer(); | 23 views::MusClient::Get()->window_tree_client()->focus_synchronizer(); |
| 23 SetActiveFocusClient(focus_synchronizer->active_focus_client(), | 24 SetActiveFocusClient(focus_synchronizer->active_focus_client(), |
| 24 focus_synchronizer->active_focus_client_root()); | 25 focus_synchronizer->active_focus_client_root()); |
| 25 focus_synchronizer->AddObserver(this); | 26 focus_synchronizer->AddObserver(this); |
| 26 } | 27 } |
| 27 | 28 |
| 28 WMHelperMus::~WMHelperMus() { | 29 WMHelperMus::~WMHelperMus() { |
| 29 if (active_focus_client_) | 30 if (active_focus_client_) |
| 30 active_focus_client_->RemoveObserver(this); | 31 active_focus_client_->RemoveObserver(this); |
| 31 views::MusClient::Get() | 32 views::MusClient::Get() |
| 32 ->window_tree_client() | 33 ->window_tree_client() |
| 33 ->focus_synchronizer() | 34 ->focus_synchronizer() |
| 34 ->RemoveObserver(this); | 35 ->RemoveObserver(this); |
| 35 } | 36 } |
| 36 | 37 |
| 37 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
| 38 // WMHelperMus, private: | 39 // WMHelperMus, private: |
| 39 | 40 |
| 40 const display::ManagedDisplayInfo WMHelperMus::GetDisplayInfo( | 41 const display::ManagedDisplayInfo& WMHelperMus::GetDisplayInfo( |
| 41 int64_t display_id) const { | 42 int64_t display_id) const { |
| 42 // TODO(penghuang): Return real display info when it is supported in mus. | 43 // TODO(penghuang): Return real display info when it is supported in mus. |
| 43 return display::ManagedDisplayInfo(display_id, "", false); | 44 static const display::ManagedDisplayInfo info; |
| 45 return info; |
| 44 } | 46 } |
| 45 | 47 |
| 46 aura::Window* WMHelperMus::GetContainer(int container_id) { | 48 aura::Window* WMHelperMus::GetPrimaryDisplayContainer(int container_id) { |
| 47 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 48 return nullptr; | 50 return nullptr; |
| 49 } | 51 } |
| 50 | 52 |
| 51 aura::Window* WMHelperMus::GetActiveWindow() const { | 53 aura::Window* WMHelperMus::GetActiveWindow() const { |
| 52 return active_window_; | 54 return active_window_; |
| 53 } | 55 } |
| 54 | 56 |
| 55 aura::Window* WMHelperMus::GetFocusedWindow() const { | 57 aura::Window* WMHelperMus::GetFocusedWindow() const { |
| 56 return focused_window_; | 58 return focused_window_; |
| 57 } | 59 } |
| 58 | 60 |
| 59 ui::CursorSetType WMHelperMus::GetCursorSet() const { | 61 ui::CursorSetType WMHelperMus::GetCursorSet() const { |
| 60 NOTIMPLEMENTED(); | 62 NOTIMPLEMENTED(); |
| 61 return ui::CursorSetType::CURSOR_SET_NORMAL; | 63 return ui::CursorSetType::CURSOR_SET_NORMAL; |
| 62 } | 64 } |
| 63 | 65 |
| 66 const display::Display& WMHelperMus::GetCursorDisplay() const { |
| 67 NOTIMPLEMENTED(); |
| 68 // TODO(penghuang): Return real display when supported in mus. |
| 69 static const display::Display display; |
| 70 return display; |
| 71 } |
| 72 |
| 64 void WMHelperMus::AddPreTargetHandler(ui::EventHandler* handler) { | 73 void WMHelperMus::AddPreTargetHandler(ui::EventHandler* handler) { |
| 65 aura::Env::GetInstance()->AddPreTargetHandler(handler); | 74 aura::Env::GetInstance()->AddPreTargetHandler(handler); |
| 66 } | 75 } |
| 67 | 76 |
| 68 void WMHelperMus::PrependPreTargetHandler(ui::EventHandler* handler) { | 77 void WMHelperMus::PrependPreTargetHandler(ui::EventHandler* handler) { |
| 69 aura::Env::GetInstance()->PrependPreTargetHandler(handler); | 78 aura::Env::GetInstance()->PrependPreTargetHandler(handler); |
| 70 } | 79 } |
| 71 | 80 |
| 72 void WMHelperMus::RemovePreTargetHandler(ui::EventHandler* handler) { | 81 void WMHelperMus::RemovePreTargetHandler(ui::EventHandler* handler) { |
| 73 aura::Env::GetInstance()->RemovePreTargetHandler(handler); | 82 aura::Env::GetInstance()->RemovePreTargetHandler(handler); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 NotifyWindowFocused(focused_window_, lost_focus); | 148 NotifyWindowFocused(focused_window_, lost_focus); |
| 140 } | 149 } |
| 141 | 150 |
| 142 aura::client::ActivationClient* WMHelperMus::GetActivationClient() { | 151 aura::client::ActivationClient* WMHelperMus::GetActivationClient() { |
| 143 return root_with_active_focus_client_ | 152 return root_with_active_focus_client_ |
| 144 ? aura::client::GetActivationClient(root_with_active_focus_client_) | 153 ? aura::client::GetActivationClient(root_with_active_focus_client_) |
| 145 : nullptr; | 154 : nullptr; |
| 146 } | 155 } |
| 147 | 156 |
| 148 } // namespace exo | 157 } // namespace exo |
| OLD | NEW |