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

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

Issue 2280763002: exo: Use aura::Env()->Add{Pre,Post}TargetHandler to simplfy WmHelperMus. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | components/exo/wm_helper_mus.cc » ('j') | components/exo/wm_helper_mus.cc » ('J')
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 #ifndef COMPONENTS_EXO_WM_HELPER_MUS_H_ 5 #ifndef COMPONENTS_EXO_WM_HELPER_MUS_H_
6 #define COMPONENTS_EXO_WM_HELPER_MUS_H_ 6 #define COMPONENTS_EXO_WM_HELPER_MUS_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/exo/wm_helper.h" 9 #include "components/exo/wm_helper.h"
10 #include "services/ui/public/cpp/window_tree_client_observer.h" 10 #include "services/ui/public/cpp/window_tree_client_observer.h"
11 #include "ui/aura/client/focus_change_observer.h" 11 #include "ui/aura/client/focus_change_observer.h"
12 #include "ui/aura/env_observer.h"
13 #include "ui/events/event_handler.h"
14 12
15 namespace exo { 13 namespace exo {
16 14
17 // A helper class for accessing WindowManager related features. 15 // A helper class for accessing WindowManager related features.
18 class WMHelperMus : public WMHelper, 16 class WMHelperMus : public WMHelper,
19 public aura::EnvObserver,
20 public ui::EventHandler,
21 public ui::WindowTreeClientObserver, 17 public ui::WindowTreeClientObserver,
22 public aura::client::FocusChangeObserver { 18 public aura::client::FocusChangeObserver {
23 public: 19 public:
24 WMHelperMus(); 20 WMHelperMus();
25 ~WMHelperMus() override; 21 ~WMHelperMus() override;
26 22
27 // Overriden from WMHelper: 23 // Overriden from WMHelper:
28 const ash::DisplayInfo GetDisplayInfo(int64_t display_id) const override; 24 const ash::DisplayInfo GetDisplayInfo(int64_t display_id) const override;
29 aura::Window* GetContainer(int container_id) override; 25 aura::Window* GetContainer(int container_id) override;
30 aura::Window* GetActiveWindow() const override; 26 aura::Window* GetActiveWindow() const override;
31 aura::Window* GetFocusedWindow() const override; 27 aura::Window* GetFocusedWindow() const override;
32 ui::CursorSetType GetCursorSet() const override; 28 ui::CursorSetType GetCursorSet() const override;
33 void AddPreTargetHandler(ui::EventHandler* handler) override; 29 void AddPreTargetHandler(ui::EventHandler* handler) override;
34 void PrependPreTargetHandler(ui::EventHandler* handler) override; 30 void PrependPreTargetHandler(ui::EventHandler* handler) override;
35 void RemovePreTargetHandler(ui::EventHandler* handler) override; 31 void RemovePreTargetHandler(ui::EventHandler* handler) override;
36 void AddPostTargetHandler(ui::EventHandler* handler) override; 32 void AddPostTargetHandler(ui::EventHandler* handler) override;
37 void RemovePostTargetHandler(ui::EventHandler* handler) override; 33 void RemovePostTargetHandler(ui::EventHandler* handler) override;
38 bool IsMaximizeModeWindowManagerEnabled() const override; 34 bool IsMaximizeModeWindowManagerEnabled() const override;
39 35
40 // Overriden from aura::EnvObserver:
41 void OnWindowInitialized(aura::Window* window) override {}
42 void OnHostInitialized(aura::WindowTreeHost* host) override;
43
44 // Overriden from ui::WindowTreeClientObserver: 36 // Overriden from ui::WindowTreeClientObserver:
45 void OnWindowTreeFocusChanged(ui::Window* gained_focus, 37 void OnWindowTreeFocusChanged(ui::Window* gained_focus,
46 ui::Window* lost_focus) override; 38 ui::Window* lost_focus) override;
47 39
48 // Overriden from ui::client::FocusChangeObserver: 40 // Overriden from ui::client::FocusChangeObserver:
49 void OnWindowFocused(aura::Window* gained_focus, 41 void OnWindowFocused(aura::Window* gained_focus,
50 aura::Window* lost_focus) override; 42 aura::Window* lost_focus) override;
51 43
52 private: 44 private:
53 class EventForwarder;
54
55 ui::EventHandlerList pre_target_list_;
56 ui::EventHandlerList post_target_list_;
57
58 std::unique_ptr<EventForwarder> pre_target_event_forwarder_;
59 std::unique_ptr<EventForwarder> post_target_event_forwarder_;
60
61 aura::Window* active_window_; 45 aura::Window* active_window_;
62 aura::Window* focused_window_; 46 aura::Window* focused_window_;
63 47
64 DISALLOW_COPY_AND_ASSIGN(WMHelperMus); 48 DISALLOW_COPY_AND_ASSIGN(WMHelperMus);
65 }; 49 };
66 50
67 } // namespace exo 51 } // namespace exo
68 52
69 #endif // COMPONENTS_EXO_WM_HELPER_H_ 53 #endif // COMPONENTS_EXO_WM_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | components/exo/wm_helper_mus.cc » ('j') | components/exo/wm_helper_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698