Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / app_window / native_app_window.h
blob40da36834b17defe1d382e915f8994de6826c09d
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.
5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
6 #define EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "components/web_modal/web_contents_modal_dialog_host.h"
12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/base/base_window.h"
14 #include "ui/gfx/geometry/insets.h"
16 namespace content {
17 struct NativeWebKeyboardEvent;
20 namespace extensions {
22 struct DraggableRegion;
24 // This is an interface to a native implementation of a app window, used for
25 // new-style packaged apps. App windows contain a web contents, but no tabs
26 // or URL bar.
27 class NativeAppWindow : public ui::BaseWindow,
28 public web_modal::WebContentsModalDialogHost {
29 public:
30 // Sets whether the window is fullscreen and the type of fullscreen.
31 // |fullscreen_types| is a bit field of AppWindow::FullscreenType.
32 virtual void SetFullscreen(int fullscreen_types) = 0;
34 // Returns whether the window is fullscreen or about to enter fullscreen.
35 virtual bool IsFullscreenOrPending() const = 0;
37 // Called when the icon of the window changes.
38 virtual void UpdateWindowIcon() = 0;
40 // Called when the title of the window changes.
41 virtual void UpdateWindowTitle() = 0;
43 // Called when the draggable regions are changed.
44 virtual void UpdateDraggableRegions(
45 const std::vector<DraggableRegion>& regions) = 0;
47 // Returns the region used by frameless windows for dragging. May return NULL.
48 virtual SkRegion* GetDraggableRegion() = 0;
50 // Called when the window shape is changed. If |region| is NULL then the
51 // window is restored to the default shape.
52 virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0;
54 // Allows the window to handle unhandled keyboard messages coming back from
55 // the renderer.
56 virtual void HandleKeyboardEvent(
57 const content::NativeWebKeyboardEvent& event) = 0;
59 // Returns true if the window has no frame, as for a window opened by
60 // chrome.app.window.create with the option 'frame' set to 'none'.
61 virtual bool IsFrameless() const = 0;
63 // Returns information about the window's frame.
64 virtual bool HasFrameColor() const = 0;
65 virtual SkColor ActiveFrameColor() const = 0;
66 virtual SkColor InactiveFrameColor() const = 0;
68 // Returns the difference between the window bounds (including titlebar and
69 // borders) and the content bounds, if any.
70 virtual gfx::Insets GetFrameInsets() const = 0;
72 // Hide or show this window as part of hiding or showing the app.
73 // This may have different logic to Hide, Show, and ShowInactive as those are
74 // called via the AppWindow javascript API.
75 virtual void ShowWithApp() = 0;
76 virtual void HideWithApp() = 0;
78 // Returns the minimum size constraints of the content.
79 virtual gfx::Size GetContentMinimumSize() const = 0;
81 // Returns the maximum size constraints of the content.
82 virtual gfx::Size GetContentMaximumSize() const = 0;
84 // Updates the minimum and maximum size constraints of the content.
85 virtual void SetContentSizeConstraints(const gfx::Size& min_size,
86 const gfx::Size& max_size) = 0;
88 // Sets whether the window should be visible on all workspaces.
89 virtual void SetVisibleOnAllWorkspaces(bool always_visible) = 0;
91 // Returns false if the underlying native window ignores alpha transparency
92 // when compositing.
93 virtual bool CanHaveAlphaEnabled() const = 0;
95 ~NativeAppWindow() override {}
98 } // namespace extensions
100 #endif // EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_