Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 ASH_MUS_PROPERTY_UTIL_H_ | 5 #ifndef ASH_MUS_PROPERTY_UTIL_H_ |
| 6 #define ASH_MUS_PROPERTY_UTIL_H_ | 6 #define ASH_MUS_PROPERTY_UTIL_H_ |
| 7 | 7 |
| 8 #include "ash/public/interfaces/ash_window_type.mojom.h" | 8 #include <stdint.h> |
| 9 #include "services/ui/public/cpp/window.h" | 9 |
| 10 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 10 #include <map> |
| 11 #include "ui/wm/public/window_types.h" | 11 #include <string> |
| 12 #include <vector> | |
| 12 | 13 |
| 13 namespace gfx { | 14 namespace gfx { |
| 14 class Rect; | 15 class Rect; |
| 15 class Size; | 16 class Size; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace ui { | |
| 19 class Window; | |
| 20 } | |
| 21 | |
| 22 namespace ash { | 19 namespace ash { |
| 23 namespace mus { | 20 namespace mus { |
| 24 | 21 |
| 25 class Shadow; | 22 // Functions for extracting properties that are used at a Window creation time. |
| 23 // When an aura::Window is created at the request of a client an initial set of | |
| 24 // properties is supplied to allow the WindowManager (ash) to configure the | |
| 25 // newly created window. Not all of these properties need be persisted, some are | |
| 26 // used solely to configure the window. This file contains the functions used | |
| 27 // to extract these properties. | |
| 28 // Long lived properties are converted and stored as properties on the | |
|
James Cook
2016/12/05 22:56:34
super-nit: empty line above or re-wrap
Nice docs,
| |
| 29 // associated aura::Window. See aura::PropertyConverter for this set of | |
| 30 // properties. | |
| 26 | 31 |
| 27 // Utility functions to read values from properties & convert them to the | 32 using InitProperties = std::map<std::string, std::vector<uint8_t>>; |
| 28 // appropriate types. | |
| 29 | 33 |
| 30 void SetWindowShowState(ui::Window* window, ui::mojom::ShowState show_state); | 34 // Returns the kInitialDisplayId_Property if present, otherwise |
| 31 ui::mojom::ShowState GetWindowShowState(const ui::Window* window); | 35 // kInvalidDisplayID. |
| 32 | 36 int64_t GetInitialDisplayId(const InitProperties& properties); |
| 33 void SetWindowUserSetBounds(ui::Window* window, const gfx::Rect& bounds); | |
| 34 gfx::Rect GetWindowUserSetBounds(const ui::Window* window); | |
| 35 | |
| 36 void SetWindowPreferredSize(ui::Window* window, const gfx::Size& size); | |
| 37 gfx::Size GetWindowPreferredSize(const ui::Window* window); | |
| 38 | 37 |
| 39 // If |window| has the |kInitialContainerId_Property| set as a property, then | 38 // If |window| has the |kInitialContainerId_Property| set as a property, then |
| 40 // the value of |kInitialContainerId_Property| is set in |container_id| and true | 39 // the value of |kInitialContainerId_Property| is set in |container_id| and true |
| 41 // is returned. Otherwise false is returned. | 40 // is returned. Otherwise false is returned. |
| 42 bool GetRequestedContainer(const ui::Window* window, int* container_id); | 41 bool GetInitialContainerId(const InitProperties& properties, int* container_id); |
| 43 | 42 |
| 44 // Returns a bitfield of kResizeBehavior* values from | 43 bool GetInitialBounds(const InitProperties& properties, gfx::Rect* bounds); |
| 45 // window_manager_constants.mojom. | |
| 46 void SetResizeBehavior(ui::Window::SharedProperties* properties, | |
| 47 int32_t resize_behavior); | |
| 48 int32_t GetResizeBehavior(const ui::Window* window); | |
| 49 | 44 |
| 50 void SetRestoreBounds(ui::Window* window, const gfx::Rect& bounds); | 45 bool GetWindowPreferredSize(const InitProperties& properties, gfx::Size* size); |
| 51 gfx::Rect GetRestoreBounds(const ui::Window* window); | |
| 52 | 46 |
| 53 void SetShadow(ui::Window* window, Shadow* shadow); | 47 bool ShouldRemoveStandardFrame(const InitProperties& properties); |
| 54 Shadow* GetShadow(const ui::Window* window); | |
| 55 | 48 |
| 56 ui::mojom::WindowType GetWindowType(const ui::Window* window); | 49 bool ShouldEnableImmersive(const InitProperties& properties); |
| 57 ui::mojom::WindowType GetWindowType(const ui::Window::SharedProperties& window); | |
| 58 | |
| 59 ui::wm::WindowType GetWmWindowType(const ui::Window* window); | |
| 60 | |
| 61 mojom::AshWindowType GetAshWindowType(const ui::Window* window); | |
| 62 | |
| 63 void SetWindowTitle(ui::Window* window, base::string16 title); | |
| 64 base::string16 GetWindowTitle(const ui::Window* window); | |
| 65 | |
| 66 void SetAppID(ui::Window* window, const base::string16& app_id); | |
| 67 base::string16 GetAppID(const ui::Window* window); | |
| 68 | |
| 69 bool GetWindowIgnoredByShelf(ui::Window* window); | |
| 70 | |
| 71 void SetWindowIsJanky(ui::Window* window, bool janky); | |
| 72 bool IsWindowJanky(ui::Window* window); | |
| 73 bool IsWindowJankyProperty(const void* key); | |
| 74 | |
| 75 void SetAlwaysOnTop(ui::Window* window, bool value); | |
| 76 bool IsAlwaysOnTop(ui::Window* window); | |
| 77 | |
| 78 bool ShouldRemoveStandardFrame(ui::Window* window); | |
| 79 | |
| 80 // See description of |WindowManager::kRendererParentTitleArea_Property|. | |
| 81 bool ShouldRenderParentTitleArea(ui::Window* window); | |
| 82 | |
| 83 // Returns the kInitialDisplayId_Property if present, otherwise | |
| 84 // kInvalidDisplayID. | |
| 85 int64_t GetInitialDisplayId(const ui::Window::SharedProperties& properties); | |
| 86 | |
| 87 // Manipulates the kExcludeFromMru_Property property. | |
| 88 void SetExcludeFromMru(ui::Window* window, bool value); | |
| 89 | |
| 90 // Returns true if the property is set and true, otherwise false. | |
| 91 bool GetExcludeFromMru(const ui::Window* window); | |
| 92 | 50 |
| 93 } // namespace mus | 51 } // namespace mus |
| 94 } // namespace ash | 52 } // namespace ash |
| 95 | 53 |
| 96 #endif // ASH_MUS_PROPERTY_UTIL_H_ | 54 #endif // ASH_MUS_PROPERTY_UTIL_H_ |
| OLD | NEW |