1 // Copyright 2013 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 APPS_UI_NATIVE_APP_WINDOW_H_
6 #define APPS_UI_NATIVE_APP_WINDOW_H_
8 #include "apps/shell_window.h"
9 #include "components/web_modal/web_contents_modal_dialog_host.h"
10 #include "ui/base/base_window.h"
11 #include "ui/gfx/insets.h"
15 // This is an interface to a native implementation of a shell window, used for
16 // new-style packaged apps. Shell windows contain a web contents, but no tabs
18 class NativeAppWindow : public ui::BaseWindow,
19 public web_modal::WebContentsModalDialogHost {
21 // Fullscreen changes may be asynchronous on some platforms.
22 virtual void SetFullscreen(bool fullscreen) = 0;
23 virtual bool IsFullscreenOrPending() const = 0;
25 // Returns true if the window is a panel that has been detached.
26 virtual bool IsDetached() const = 0;
28 // Called when the icon of the window changes.
29 virtual void UpdateWindowIcon() = 0;
31 // Called when the title of the window changes.
32 virtual void UpdateWindowTitle() = 0;
34 // Called when the draggable regions are changed.
35 virtual void UpdateDraggableRegions(
36 const std::vector<extensions::DraggableRegion>& regions) = 0;
38 // Returns the region used by frameless windows for dragging. May return NULL.
39 virtual SkRegion* GetDraggableRegion() = 0;
41 // Called when the region that accepts input events is changed.
42 // If |region| is NULL, then the entire window will accept input events.
43 virtual void UpdateInputRegion(scoped_ptr<SkRegion> region) = 0;
45 // Allows the window to handle unhandled keyboard messages coming back from
47 virtual void HandleKeyboardEvent(
48 const content::NativeWebKeyboardEvent& event) = 0;
50 // Returns true if the window has no frame, as for a window opened by
51 // chrome.app.window.create with the option 'frame' set to 'none'.
52 virtual bool IsFrameless() const = 0;
54 // Returns the difference between the window bounds (including titlebar and
55 // borders) and the content bounds, if any.
56 virtual gfx::Insets GetFrameInsets() const = 0;
58 // Hide or show this window as part of hiding or showing the app.
59 // This may have different logic to Hide, Show, and ShowInactive as those are
60 // called via the AppWindow javascript API.
61 virtual void ShowWithApp() = 0;
62 virtual void HideWithApp() = 0;
64 // Updates the minimum and maximum size of the native window with the current
66 virtual void UpdateWindowMinMaxSize() = 0;
68 virtual ~NativeAppWindow() {}
73 #endif // APPS_UI_NATIVE_APP_WINDOW_H_