OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |
| 6 #define COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |
| 7 |
| 8 #include "components/native_app_window/native_app_window_export.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/base/ui_base_types.h" |
| 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" |
| 13 |
| 14 namespace native_app_window { |
| 15 |
| 16 enum WindowType { |
| 17 WINDOW_TYPE_DEFAULT = 1 << 0, // Default app window. |
| 18 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). |
| 19 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate |
| 20 // with v1 apps. |
| 21 }; |
| 22 |
| 23 enum FullscreenType { |
| 24 // Not fullscreen. |
| 25 FULLSCREEN_TYPE_NONE = 0, |
| 26 |
| 27 // Fullscreen entered by the app.window api. |
| 28 FULLSCREEN_TYPE_WINDOW_API = 1 << 0, |
| 29 |
| 30 // Fullscreen entered by HTML requestFullscreen(). |
| 31 FULLSCREEN_TYPE_HTML_API = 1 << 1, |
| 32 |
| 33 // Fullscreen entered by the OS. ChromeOS uses this type of fullscreen to |
| 34 // enter immersive fullscreen when the user hits the <F4> key. |
| 35 FULLSCREEN_TYPE_OS = 1 << 2, |
| 36 |
| 37 // Fullscreen mode that could not be exited by the user. ChromeOS uses |
| 38 // this type of fullscreen to run an app in kiosk mode. |
| 39 FULLSCREEN_TYPE_FORCED = 1 << 3, |
| 40 }; |
| 41 |
| 42 enum Frame { |
| 43 FRAME_CHROME, // Chrome-style window frame. |
| 44 FRAME_NONE, // Frameless window. |
| 45 }; |
| 46 |
| 47 struct NATIVE_APP_WINDOW_EXPORT BoundsSpecification { |
| 48 // INT_MIN represents an unspecified position component. |
| 49 static const int kUnspecifiedPosition; |
| 50 |
| 51 BoundsSpecification(); |
| 52 ~BoundsSpecification(); |
| 53 |
| 54 // INT_MIN designates 'unspecified' for the position components, and 0 |
| 55 // designates 'unspecified' for the size components. When unspecified, |
| 56 // they should be replaced with a default value. |
| 57 gfx::Rect bounds; |
| 58 |
| 59 gfx::Size minimum_size; |
| 60 gfx::Size maximum_size; |
| 61 |
| 62 // Reset the bounds fields to their 'unspecified' values. The minimum and |
| 63 // maximum size constraints remain unchanged. |
| 64 void ResetBounds(); |
| 65 }; |
| 66 |
| 67 class NATIVE_APP_WINDOW_EXPORT AppWindowCreateParams { |
| 68 public: |
| 69 AppWindowCreateParams(); |
| 70 ~AppWindowCreateParams(); |
| 71 |
| 72 WindowType window_type; |
| 73 Frame frame; |
| 74 |
| 75 bool has_frame_color; |
| 76 SkColor active_frame_color; |
| 77 SkColor inactive_frame_color; |
| 78 bool alpha_enabled; |
| 79 bool is_ime_window; |
| 80 |
| 81 // The initial content/inner bounds specification (excluding any window |
| 82 // decorations). |
| 83 BoundsSpecification content_spec; |
| 84 |
| 85 // The initial window/outer bounds specification (including window |
| 86 // decorations). |
| 87 BoundsSpecification window_spec; |
| 88 |
| 89 std::string window_key; |
| 90 |
| 91 // The process ID of the process that requested the create. |
| 92 int32 creator_process_id; |
| 93 |
| 94 // Initial state of the window. |
| 95 ui::WindowShowState state; |
| 96 |
| 97 // If true, don't show the window after creation. |
| 98 bool hidden; |
| 99 |
| 100 // If true, the window will be resizable by the user. Defaults to true. |
| 101 bool resizable; |
| 102 |
| 103 // If true, the window will be focused on creation. Defaults to true. |
| 104 bool focused; |
| 105 |
| 106 // If true, the window will stay on top of other windows that are not |
| 107 // configured to be always on top. Defaults to false. |
| 108 bool always_on_top; |
| 109 |
| 110 // If true, the window will be visible on all workspaces. Defaults to false. |
| 111 bool visible_on_all_workspaces; |
| 112 |
| 113 // The API enables developers to specify content or window bounds. This |
| 114 // function combines them into a single, constrained window size. |
| 115 gfx::Rect GetInitialWindowBounds(const gfx::Insets& frame_insets) const; |
| 116 |
| 117 // The API enables developers to specify content or window size constraints. |
| 118 // These functions combine them so that we can work with one set of |
| 119 // constraints. |
| 120 gfx::Size GetContentMinimumSize(const gfx::Insets& frame_insets) const; |
| 121 gfx::Size GetContentMaximumSize(const gfx::Insets& frame_insets) const; |
| 122 gfx::Size GetWindowMinimumSize(const gfx::Insets& frame_insets) const; |
| 123 gfx::Size GetWindowMaximumSize(const gfx::Insets& frame_insets) const; |
| 124 }; |
| 125 |
| 126 } // namespace native_app_window |
| 127 |
| 128 #endif // COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |
OLD | NEW |