• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef APPS_UI_NATIVE_APP_WINDOW_H_
6 #define APPS_UI_NATIVE_APP_WINDOW_H_
7 
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"
12 
13 namespace apps {
14 
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
17 // or URL bar.
18 class NativeAppWindow : public ui::BaseWindow,
19                         public web_modal::WebContentsModalDialogHost {
20  public:
21   // Sets whether the window is fullscreen and the type of fullscreen.
22   // |fullscreen_types| is a bit field of ShellWindow::FullscreenType.
23   virtual void SetFullscreen(int fullscreen_types) = 0;
24 
25   // Returns whether the window is fullscreen or about to enter fullscreen.
26   virtual bool IsFullscreenOrPending() const = 0;
27 
28   // Returns true if the window is a panel that has been detached.
29   virtual bool IsDetached() const = 0;
30 
31   // Called when the icon of the window changes.
32   virtual void UpdateWindowIcon() = 0;
33 
34   // Called when the title of the window changes.
35   virtual void UpdateWindowTitle() = 0;
36 
37   // Called when the draggable regions are changed.
38   virtual void UpdateDraggableRegions(
39       const std::vector<extensions::DraggableRegion>& regions) = 0;
40 
41   // Returns the region used by frameless windows for dragging. May return NULL.
42   virtual SkRegion* GetDraggableRegion() = 0;
43 
44   // Called when the window shape is changed. If |region| is NULL then the
45   // window is restored to the default shape.
46   virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0;
47 
48   // Allows the window to handle unhandled keyboard messages coming back from
49   // the renderer.
50   virtual void HandleKeyboardEvent(
51       const content::NativeWebKeyboardEvent& event) = 0;
52 
53   // Returns true if the window has no frame, as for a window opened by
54   // chrome.app.window.create with the option 'frame' set to 'none'.
55   virtual bool IsFrameless() const = 0;
56 
57   // Returns the difference between the window bounds (including titlebar and
58   // borders) and the content bounds, if any.
59   virtual gfx::Insets GetFrameInsets() const = 0;
60 
61   // Hide or show this window as part of hiding or showing the app.
62   // This may have different logic to Hide, Show, and ShowInactive as those are
63   // called via the AppWindow javascript API.
64   virtual void ShowWithApp() = 0;
65   virtual void HideWithApp() = 0;
66 
67   // Updates the minimum and maximum size of the native window with the current
68   // size constraints.
69   virtual void UpdateWindowMinMaxSize() = 0;
70 
~NativeAppWindow()71   virtual ~NativeAppWindow() {}
72 };
73 
74 }  // namespace apps
75 
76 #endif  // APPS_UI_NATIVE_APP_WINDOW_H_
77