Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / app_window / native_app_window.h
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 EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
6 #define EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
7
8 #include <vector>
9
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/insets.h"
15
16 namespace content {
17 struct NativeWebKeyboardEvent;
18 }
19
20 namespace extensions {
21
22 struct DraggableRegion;
23
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;
33
34   // Returns whether the window is fullscreen or about to enter fullscreen.
35   virtual bool IsFullscreenOrPending() const = 0;
36
37   // Called when the icon of the window changes.
38   virtual void UpdateWindowIcon() = 0;
39
40   // Called when the title of the window changes.
41   virtual void UpdateWindowTitle() = 0;
42
43   // Called to update the badge icon.
44   virtual void UpdateBadgeIcon() = 0;
45
46   // Called when the draggable regions are changed.
47   virtual void UpdateDraggableRegions(
48       const std::vector<DraggableRegion>& regions) = 0;
49
50   // Returns the region used by frameless windows for dragging. May return NULL.
51   virtual SkRegion* GetDraggableRegion() = 0;
52
53   // Called when the window shape is changed. If |region| is NULL then the
54   // window is restored to the default shape.
55   virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0;
56
57   // Allows the window to handle unhandled keyboard messages coming back from
58   // the renderer.
59   virtual void HandleKeyboardEvent(
60       const content::NativeWebKeyboardEvent& event) = 0;
61
62   // Returns true if the window has no frame, as for a window opened by
63   // chrome.app.window.create with the option 'frame' set to 'none'.
64   virtual bool IsFrameless() const = 0;
65
66   // Returns information about the window's frame.
67   virtual bool HasFrameColor() const = 0;
68   virtual SkColor ActiveFrameColor() const = 0;
69   virtual SkColor InactiveFrameColor() const = 0;
70
71   // Returns the difference between the window bounds (including titlebar and
72   // borders) and the content bounds, if any.
73   virtual gfx::Insets GetFrameInsets() const = 0;
74
75   // Hide or show this window as part of hiding or showing the app.
76   // This may have different logic to Hide, Show, and ShowInactive as those are
77   // called via the AppWindow javascript API.
78   virtual void ShowWithApp() = 0;
79   virtual void HideWithApp() = 0;
80
81   // Updates custom entries for the context menu of the app's taskbar/dock/shelf
82   // icon.
83   virtual void UpdateShelfMenu() = 0;
84
85   // Returns the minimum size constraints of the content.
86   virtual gfx::Size GetContentMinimumSize() const = 0;
87
88   // Returns the maximum size constraints of the content.
89   virtual gfx::Size GetContentMaximumSize() const = 0;
90
91   // Updates the minimum and maximum size constraints of the content.
92   virtual void SetContentSizeConstraints(const gfx::Size& min_size,
93                                          const gfx::Size& max_size) = 0;
94
95   // Returns whether the window show be visible on all workspaces.
96   virtual void SetVisibleOnAllWorkspaces(bool always_visible) = 0;
97
98   // Returns false if the underlying native window ignores alpha transparency
99   // when compositing.
100   virtual bool CanHaveAlphaEnabled() const = 0;
101
102   virtual ~NativeAppWindow() {}
103 };
104
105 }  // namespace extensions
106
107 #endif  // EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_