Index: components/native_app_window/app_window_create_params.h |
diff --git a/components/native_app_window/app_window_create_params.h b/components/native_app_window/app_window_create_params.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..29041fe5fd22f3d0043f7721418e34ca7e2726cb |
--- /dev/null |
+++ b/components/native_app_window/app_window_create_params.h |
@@ -0,0 +1,128 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |
+#define COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |
+ |
+#include "components/native_app_window/native_app_window_export.h" |
+#include "third_party/skia/include/core/SkColor.h" |
+#include "ui/base/ui_base_types.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace native_app_window { |
+ |
+enum WindowType { |
+ WINDOW_TYPE_DEFAULT = 1 << 0, // Default app window. |
+ WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). |
+ WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate |
+ // with v1 apps. |
+}; |
+ |
+enum FullscreenType { |
+ // Not fullscreen. |
+ FULLSCREEN_TYPE_NONE = 0, |
+ |
+ // Fullscreen entered by the app.window api. |
+ FULLSCREEN_TYPE_WINDOW_API = 1 << 0, |
+ |
+ // Fullscreen entered by HTML requestFullscreen(). |
+ FULLSCREEN_TYPE_HTML_API = 1 << 1, |
+ |
+ // Fullscreen entered by the OS. ChromeOS uses this type of fullscreen to |
+ // enter immersive fullscreen when the user hits the <F4> key. |
+ FULLSCREEN_TYPE_OS = 1 << 2, |
+ |
+ // Fullscreen mode that could not be exited by the user. ChromeOS uses |
+ // this type of fullscreen to run an app in kiosk mode. |
+ FULLSCREEN_TYPE_FORCED = 1 << 3, |
+}; |
+ |
+enum Frame { |
+ FRAME_CHROME, // Chrome-style window frame. |
+ FRAME_NONE, // Frameless window. |
+}; |
+ |
+struct NATIVE_APP_WINDOW_EXPORT BoundsSpecification { |
+ // INT_MIN represents an unspecified position component. |
+ static const int kUnspecifiedPosition; |
+ |
+ BoundsSpecification(); |
+ ~BoundsSpecification(); |
+ |
+ // INT_MIN designates 'unspecified' for the position components, and 0 |
+ // designates 'unspecified' for the size components. When unspecified, |
+ // they should be replaced with a default value. |
+ gfx::Rect bounds; |
+ |
+ gfx::Size minimum_size; |
+ gfx::Size maximum_size; |
+ |
+ // Reset the bounds fields to their 'unspecified' values. The minimum and |
+ // maximum size constraints remain unchanged. |
+ void ResetBounds(); |
+}; |
+ |
+class NATIVE_APP_WINDOW_EXPORT AppWindowCreateParams { |
+ public: |
+ AppWindowCreateParams(); |
+ ~AppWindowCreateParams(); |
+ |
+ WindowType window_type; |
+ Frame frame; |
+ |
+ bool has_frame_color; |
+ SkColor active_frame_color; |
+ SkColor inactive_frame_color; |
+ bool alpha_enabled; |
+ bool is_ime_window; |
+ |
+ // The initial content/inner bounds specification (excluding any window |
+ // decorations). |
+ BoundsSpecification content_spec; |
+ |
+ // The initial window/outer bounds specification (including window |
+ // decorations). |
+ BoundsSpecification window_spec; |
+ |
+ std::string window_key; |
+ |
+ // The process ID of the process that requested the create. |
+ int32 creator_process_id; |
+ |
+ // Initial state of the window. |
+ ui::WindowShowState state; |
+ |
+ // If true, don't show the window after creation. |
+ bool hidden; |
+ |
+ // If true, the window will be resizable by the user. Defaults to true. |
+ bool resizable; |
+ |
+ // If true, the window will be focused on creation. Defaults to true. |
+ bool focused; |
+ |
+ // If true, the window will stay on top of other windows that are not |
+ // configured to be always on top. Defaults to false. |
+ bool always_on_top; |
+ |
+ // If true, the window will be visible on all workspaces. Defaults to false. |
+ bool visible_on_all_workspaces; |
+ |
+ // The API enables developers to specify content or window bounds. This |
+ // function combines them into a single, constrained window size. |
+ gfx::Rect GetInitialWindowBounds(const gfx::Insets& frame_insets) const; |
+ |
+ // The API enables developers to specify content or window size constraints. |
+ // These functions combine them so that we can work with one set of |
+ // constraints. |
+ gfx::Size GetContentMinimumSize(const gfx::Insets& frame_insets) const; |
+ gfx::Size GetContentMaximumSize(const gfx::Insets& frame_insets) const; |
+ gfx::Size GetWindowMinimumSize(const gfx::Insets& frame_insets) const; |
+ gfx::Size GetWindowMaximumSize(const gfx::Insets& frame_insets) const; |
+}; |
+ |
+} // namespace native_app_window |
+ |
+#endif // COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_CREATE_PARAMS_H_ |