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(bool use_default_bounds
,
36 views::Widget::InitParams
* init_params
,
37 views::Widget
* widget
);
39 virtual void InitializeDefaultWindow(
40 const extensions::AppWindow::CreateParams
& create_params
);
41 virtual void InitializePanelWindow(
42 const extensions::AppWindow::CreateParams
& create_params
);
43 virtual views::NonClientFrameView
* CreateStandardDesktopAppFrame();
44 virtual views::NonClientFrameView
* CreateNonStandardAppFrame() = 0;
46 // ui::BaseWindow implementation.
47 gfx::Rect
GetRestoredBounds() const override
;
48 ui::WindowShowState
GetRestoredState() const override
;
49 bool IsAlwaysOnTop() const override
;
51 // WidgetDelegate implementation.
52 gfx::ImageSkia
GetWindowAppIcon() override
;
53 gfx::ImageSkia
GetWindowIcon() override
;
54 views::NonClientFrameView
* CreateNonClientFrameView(
55 views::Widget
* widget
) override
;
56 bool WidgetHasHitTestMask() const override
;
57 void GetWidgetHitTestMask(gfx::Path
* mask
) const override
;
59 // views::View implementation.
60 gfx::Size
GetPreferredSize() const override
;
61 bool AcceleratorPressed(const ui::Accelerator
& accelerator
) override
;
63 // NativeAppWindow implementation.
64 void SetFullscreen(int fullscreen_types
) override
;
65 bool IsFullscreenOrPending() const 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 // Custom shape of the window. If this is not set then the window has a
79 // default shape, usually rectangular.
80 scoped_ptr
<SkRegion
> shape_
;
82 bool has_frame_color_
;
83 SkColor active_frame_color_
;
84 SkColor inactive_frame_color_
;
85 gfx::Size preferred_size_
;
87 // The class that registers for keyboard shortcuts for extension commands.
88 scoped_ptr
<ExtensionKeybindingRegistryViews
> extension_keybinding_registry_
;
90 // Used to capture all keyboard events including task switching sequence.
91 scoped_ptr
<DesktopKeyboardCapture
> desktop_keyboard_capture_
;
93 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews
);
96 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_