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/app_window.h" 9 #include "components/web_modal/web_contents_modal_dialog_host.h" 10 #include "third_party/skia/include/core/SkColor.h" 11 #include "ui/base/base_window.h" 12 #include "ui/gfx/insets.h" 13 14 namespace apps { 15 16 // This is an interface to a native implementation of a app window, used for 17 // new-style packaged apps. App windows contain a web contents, but no tabs 18 // or URL bar. 19 class NativeAppWindow : public ui::BaseWindow, 20 public web_modal::WebContentsModalDialogHost { 21 public: 22 // Sets whether the window is fullscreen and the type of fullscreen. 23 // |fullscreen_types| is a bit field of AppWindow::FullscreenType. 24 virtual void SetFullscreen(int fullscreen_types) = 0; 25 26 // Returns whether the window is fullscreen or about to enter fullscreen. 27 virtual bool IsFullscreenOrPending() const = 0; 28 29 // Returns true if the window is a panel that has been detached. 30 virtual bool IsDetached() const = 0; 31 32 // Called when the icon of the window changes. 33 virtual void UpdateWindowIcon() = 0; 34 35 // Called when the title of the window changes. 36 virtual void UpdateWindowTitle() = 0; 37 38 // Called to update the badge icon. 39 virtual void UpdateBadgeIcon() = 0; 40 41 // Called when the draggable regions are changed. 42 virtual void UpdateDraggableRegions( 43 const std::vector<extensions::DraggableRegion>& regions) = 0; 44 45 // Returns the region used by frameless windows for dragging. May return NULL. 46 virtual SkRegion* GetDraggableRegion() = 0; 47 48 // Called when the window shape is changed. If |region| is NULL then the 49 // window is restored to the default shape. 50 virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0; 51 52 // Allows the window to handle unhandled keyboard messages coming back from 53 // the renderer. 54 virtual void HandleKeyboardEvent( 55 const content::NativeWebKeyboardEvent& event) = 0; 56 57 // Returns true if the window has no frame, as for a window opened by 58 // chrome.app.window.create with the option 'frame' set to 'none'. 59 virtual bool IsFrameless() const = 0; 60 61 // Returns information about the window's frame. 62 virtual bool HasFrameColor() const = 0; 63 virtual SkColor ActiveFrameColor() const = 0; 64 virtual SkColor InactiveFrameColor() const = 0; 65 66 // Returns the difference between the window bounds (including titlebar and 67 // borders) and the content bounds, if any. 68 virtual gfx::Insets GetFrameInsets() const = 0; 69 70 // Hide or show this window as part of hiding or showing the app. 71 // This may have different logic to Hide, Show, and ShowInactive as those are 72 // called via the AppWindow javascript API. 73 virtual void ShowWithApp() = 0; 74 virtual void HideWithApp() = 0; 75 76 // Updates custom entries for the context menu of the app's taskbar/dock/shelf 77 // icon. 78 virtual void UpdateShelfMenu() = 0; 79 80 // Returns the minimum size constraints of the content. 81 virtual gfx::Size GetContentMinimumSize() const = 0; 82 83 // Returns the maximum size constraints of the content. 84 virtual gfx::Size GetContentMaximumSize() const = 0; 85 86 // Updates the minimum and maximum size constraints of the content. 87 virtual void SetContentSizeConstraints(const gfx::Size& min_size, 88 const gfx::Size& max_size) = 0; 89 90 // Returns false if the underlying native window ignores alpha transparency 91 // when compositing. 92 virtual bool CanHaveAlphaEnabled() const = 0; 93 94 virtual ~NativeAppWindow() {} 95 }; 96 97 } // namespace apps 98 99 #endif // APPS_UI_NATIVE_APP_WINDOW_H_ 100