| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <map> | |
| 11 #include <memory> | |
| 12 #include <string> | |
| 13 #include <vector> | |
| 14 | |
| 15 #include "base/callback_forward.h" | |
| 16 #include "components/mus/public/interfaces/cursor.mojom.h" | |
| 17 #include "components/mus/public/interfaces/event_matcher.mojom.h" | |
| 18 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" | |
| 19 #include "ui/events/mojo/event.mojom.h" | |
| 20 | |
| 21 namespace display { | |
| 22 class Display; | |
| 23 } | |
| 24 | |
| 25 namespace gfx { | |
| 26 class Insets; | |
| 27 class Rect; | |
| 28 class Vector2d; | |
| 29 } | |
| 30 | |
| 31 namespace ui { | |
| 32 class Event; | |
| 33 } | |
| 34 | |
| 35 namespace mus { | |
| 36 | |
| 37 class Window; | |
| 38 | |
| 39 // See the mojom with the same name for details on the functions in this | |
| 40 // interface. | |
| 41 class WindowManagerClient { | |
| 42 public: | |
| 43 virtual void SetFrameDecorationValues( | |
| 44 mojom::FrameDecorationValuesPtr values) = 0; | |
| 45 virtual void SetNonClientCursor(Window* window, | |
| 46 mojom::Cursor non_client_cursor) = 0; | |
| 47 | |
| 48 virtual void AddAccelerator(uint32_t id, | |
| 49 mojom::EventMatcherPtr event_matcher, | |
| 50 const base::Callback<void(bool)>& callback) = 0; | |
| 51 virtual void RemoveAccelerator(uint32_t id) = 0; | |
| 52 virtual void AddActivationParent(Window* window) = 0; | |
| 53 virtual void RemoveActivationParent(Window* window) = 0; | |
| 54 virtual void ActivateNextWindow() = 0; | |
| 55 virtual void SetUnderlaySurfaceOffsetAndExtendedHitArea( | |
| 56 Window* window, | |
| 57 const gfx::Vector2d& offset, | |
| 58 const gfx::Insets& hit_area) = 0; | |
| 59 | |
| 60 protected: | |
| 61 virtual ~WindowManagerClient() {} | |
| 62 }; | |
| 63 | |
| 64 // Used by clients implementing a window manager. | |
| 65 // TODO(sky): this should be called WindowManager, but that's rather confusing | |
| 66 // currently. | |
| 67 class WindowManagerDelegate { | |
| 68 public: | |
| 69 // Called once to give the delegate access to functions only exposed to | |
| 70 // the WindowManager. | |
| 71 virtual void SetWindowManagerClient(WindowManagerClient* client) = 0; | |
| 72 | |
| 73 // A client requested the bounds of |window| to change to |bounds|. Return | |
| 74 // true if the bounds are allowed to change. A return value of false | |
| 75 // indicates the change is not allowed. | |
| 76 // NOTE: This should not change the bounds of |window|. Instead return the | |
| 77 // bounds the window should be in |bounds|. | |
| 78 virtual bool OnWmSetBounds(Window* window, gfx::Rect* bounds) = 0; | |
| 79 | |
| 80 // A client requested the shared property named |name| to change to | |
| 81 // |new_data|. Return true to allow the change to |new_data|, false | |
| 82 // otherwise. | |
| 83 virtual bool OnWmSetProperty( | |
| 84 Window* window, | |
| 85 const std::string& name, | |
| 86 std::unique_ptr<std::vector<uint8_t>>* new_data) = 0; | |
| 87 | |
| 88 // A client has requested a new top level window. The delegate should create | |
| 89 // and parent the window appropriately and return it. |properties| is the | |
| 90 // supplied properties from the client requesting the new window. The | |
| 91 // delegate may modify |properties| before calling NewWindow(), but the | |
| 92 // delegate does *not* own |properties|, they are valid only for the life | |
| 93 // of OnWmCreateTopLevelWindow(). | |
| 94 virtual Window* OnWmCreateTopLevelWindow( | |
| 95 std::map<std::string, std::vector<uint8_t>>* properties) = 0; | |
| 96 | |
| 97 // Called when a Mus client's jankiness changes. |windows| is the set of | |
| 98 // windows owned by the window manager in which the client is embedded. | |
| 99 virtual void OnWmClientJankinessChanged( | |
| 100 const std::set<Window*>& client_windows, | |
| 101 bool janky) = 0; | |
| 102 | |
| 103 // Called when a display is added. |window| is the root of the window tree for | |
| 104 // the specified display. | |
| 105 virtual void OnWmNewDisplay(Window* window, | |
| 106 const display::Display& display) = 0; | |
| 107 | |
| 108 virtual void OnAccelerator(uint32_t id, const ui::Event& event) = 0; | |
| 109 | |
| 110 protected: | |
| 111 virtual ~WindowManagerDelegate() {} | |
| 112 }; | |
| 113 | |
| 114 } // namespace mus | |
| 115 | |
| 116 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | |
| OLD | NEW |