| 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 SERVICES_UI_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | |
| 6 #define SERVICES_UI_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 "services/ui/public/interfaces/cursor.mojom.h" | |
| 17 #include "services/ui/public/interfaces/window_manager.mojom.h" | |
| 18 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | |
| 19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" | |
| 20 #include "ui/events/mojo/event.mojom.h" | |
| 21 | |
| 22 namespace display { | |
| 23 class Display; | |
| 24 } | |
| 25 | |
| 26 namespace gfx { | |
| 27 class Insets; | |
| 28 class Rect; | |
| 29 class Vector2d; | |
| 30 } | |
| 31 | |
| 32 namespace ui { | |
| 33 class Event; | |
| 34 } | |
| 35 | |
| 36 namespace ui { | |
| 37 | |
| 38 class Window; | |
| 39 | |
| 40 // See the mojom with the same name for details on the functions in this | |
| 41 // interface. | |
| 42 class WindowManagerClient { | |
| 43 public: | |
| 44 virtual void SetFrameDecorationValues( | |
| 45 mojom::FrameDecorationValuesPtr values) = 0; | |
| 46 virtual void SetNonClientCursor(Window* window, | |
| 47 mojom::Cursor non_client_cursor) = 0; | |
| 48 | |
| 49 virtual void AddAccelerators(std::vector<mojom::AcceleratorPtr> accelerators, | |
| 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 // Called when a display is removed. |window| is the root of the display. | |
| 109 virtual void OnWmDisplayRemoved(Window* window) = 0; | |
| 110 | |
| 111 // Called when a display is modified. | |
| 112 virtual void OnWmDisplayModified(const display::Display& display) = 0; | |
| 113 | |
| 114 virtual mojom::EventResult OnAccelerator(uint32_t id, const ui::Event& event); | |
| 115 | |
| 116 virtual void OnWmPerformMoveLoop( | |
| 117 Window* window, | |
| 118 ui::mojom::MoveLoopSource source, | |
| 119 const gfx::Point& cursor_location, | |
| 120 const base::Callback<void(bool)>& on_done) = 0; | |
| 121 | |
| 122 virtual void OnWmCancelMoveLoop(Window* window) = 0; | |
| 123 | |
| 124 protected: | |
| 125 virtual ~WindowManagerDelegate() {} | |
| 126 }; | |
| 127 | |
| 128 } // namespace ui | |
| 129 | |
| 130 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | |
| OLD | NEW |