Files.app: Dispatch 'drive-connection-changed' event on initialization of VolumeManag...
[chromium-blink-merge.git] / extensions / browser / app_window / native_app_window.h
blobfda44edbd87a4838f1d806ee8ae4894673d27eb4
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 // Set whether the window should receive all keyboard events including task
55 // switching keys.
56 virtual void SetInterceptAllKeys(bool want_all_keys) = 0;
58 // Allows the window to handle unhandled keyboard messages coming back from
59 // the renderer.
60 virtual void HandleKeyboardEvent(
61 const content::NativeWebKeyboardEvent& event) = 0;
63 // Returns true if the window has no frame, as for a window opened by
64 // chrome.app.window.create with the option 'frame' set to 'none'.
65 virtual bool IsFrameless() const = 0;
67 // Returns information about the window's frame.
68 virtual bool HasFrameColor() const = 0;
69 virtual SkColor ActiveFrameColor() const = 0;
70 virtual SkColor InactiveFrameColor() const = 0;
72 // Returns the difference between the window bounds (including titlebar and
73 // borders) and the content bounds, if any.
74 virtual gfx::Insets GetFrameInsets() const = 0;
76 // Hide or show this window as part of hiding or showing the app.
77 // This may have different logic to Hide, Show, and ShowInactive as those are
78 // called via the AppWindow javascript API.
79 virtual void ShowWithApp() = 0;
80 virtual void HideWithApp() = 0;
82 // Updates custom entries for the context menu of the app's taskbar/dock/shelf
83 // icon.
84 virtual void UpdateShelfMenu() = 0;
86 // Returns the minimum size constraints of the content.
87 virtual gfx::Size GetContentMinimumSize() const = 0;
89 // Returns the maximum size constraints of the content.
90 virtual gfx::Size GetContentMaximumSize() const = 0;
92 // Updates the minimum and maximum size constraints of the content.
93 virtual void SetContentSizeConstraints(const gfx::Size& min_size,
94 const gfx::Size& max_size) = 0;
96 // Sets whether the window should be visible on all workspaces.
97 virtual void SetVisibleOnAllWorkspaces(bool always_visible) = 0;
99 // Returns false if the underlying native window ignores alpha transparency
100 // when compositing.
101 virtual bool CanHaveAlphaEnabled() const = 0;
103 ~NativeAppWindow() override {}
106 } // namespace extensions
108 #endif // EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_