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 CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "extensions/components/native_app_window/native_app_window_views.h"
12 class AppWindowFrameView
;
15 class DesktopKeyboardCapture
;
16 class ExtensionKeybindingRegistryViews
;
18 class ChromeNativeAppWindowViews
19 : public native_app_window::NativeAppWindowViews
{
21 ChromeNativeAppWindowViews();
22 ~ChromeNativeAppWindowViews() override
;
24 SkRegion
* shape() { return shape_
.get(); }
27 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
28 // subclasses to customize the InitParams that would be passed.
29 virtual void OnBeforeWidgetInit(
30 const extensions::AppWindow::CreateParams
& create_params
,
31 views::Widget::InitParams
* init_params
,
32 views::Widget
* widget
);
33 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
34 // subclasses to customize the InitParams that would be passed.
35 virtual void OnBeforePanelWidgetInit(views::Widget::InitParams
* init_params
,
36 views::Widget
* widget
);
38 virtual void InitializeDefaultWindow(
39 const extensions::AppWindow::CreateParams
& create_params
);
40 virtual void InitializePanelWindow(
41 const extensions::AppWindow::CreateParams
& create_params
);
42 virtual views::NonClientFrameView
* CreateStandardDesktopAppFrame();
43 virtual apps::AppWindowFrameView
* CreateNonStandardAppFrame();
45 // ui::BaseWindow implementation.
46 gfx::Rect
GetRestoredBounds() const override
;
47 ui::WindowShowState
GetRestoredState() const override
;
48 bool IsAlwaysOnTop() const override
;
50 // WidgetDelegate implementation.
51 gfx::ImageSkia
GetWindowAppIcon() override
;
52 gfx::ImageSkia
GetWindowIcon() override
;
53 views::NonClientFrameView
* CreateNonClientFrameView(
54 views::Widget
* widget
) override
;
55 bool WidgetHasHitTestMask() const override
;
56 void GetWidgetHitTestMask(gfx::Path
* mask
) const override
;
58 // views::View implementation.
59 gfx::Size
GetPreferredSize() const override
;
60 bool AcceleratorPressed(const ui::Accelerator
& accelerator
) override
;
62 // NativeAppWindow implementation.
63 void SetFullscreen(int fullscreen_types
) override
;
64 bool IsFullscreenOrPending() const override
;
65 void UpdateBadgeIcon() override
;
66 void UpdateShape(scoped_ptr
<SkRegion
> region
) override
;
67 bool HasFrameColor() const override
;
68 SkColor
ActiveFrameColor() const override
;
69 SkColor
InactiveFrameColor() const override
;
70 void SetInterceptAllKeys(bool want_all_keys
) override
;
72 // NativeAppWindowViews implementation.
73 void InitializeWindow(
74 extensions::AppWindow
* app_window
,
75 const extensions::AppWindow::CreateParams
& create_params
) override
;
78 // True if the window is fullscreen or fullscreen is pending.
81 // Custom shape of the window. If this is not set then the window has a
82 // default shape, usually rectangular.
83 scoped_ptr
<SkRegion
> shape_
;
85 bool has_frame_color_
;
86 SkColor active_frame_color_
;
87 SkColor inactive_frame_color_
;
88 gfx::Size preferred_size_
;
90 // The class that registers for keyboard shortcuts for extension commands.
91 scoped_ptr
<ExtensionKeybindingRegistryViews
> extension_keybinding_registry_
;
93 // Used to capture all keyboard events including task switching sequence.
94 scoped_ptr
<DesktopKeyboardCapture
> desktop_keyboard_capture_
;
96 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews
);
99 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_