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 ExtensionKeybindingRegistryViews
;
17 class ChromeNativeAppWindowViews
18 : public native_app_window::NativeAppWindowViews
{
20 ChromeNativeAppWindowViews();
21 ~ChromeNativeAppWindowViews() override
;
23 SkRegion
* shape() { return shape_
.get(); }
26 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
27 // subclasses to customize the InitParams that would be passed.
28 virtual void OnBeforeWidgetInit(
29 const extensions::AppWindow::CreateParams
& create_params
,
30 views::Widget::InitParams
* init_params
,
31 views::Widget
* widget
);
32 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
33 // subclasses to customize the InitParams that would be passed.
34 virtual void OnBeforePanelWidgetInit(bool use_default_bounds
,
35 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 views::NonClientFrameView
* CreateNonStandardAppFrame() = 0;
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 UpdateShape(scoped_ptr
<SkRegion
> region
) override
;
66 bool HasFrameColor() const override
;
67 SkColor
ActiveFrameColor() const override
;
68 SkColor
InactiveFrameColor() const override
;
70 // NativeAppWindowViews implementation.
71 void InitializeWindow(
72 extensions::AppWindow
* app_window
,
73 const extensions::AppWindow::CreateParams
& create_params
) override
;
76 // Custom shape of the window. If this is not set then the window has a
77 // default shape, usually rectangular.
78 scoped_ptr
<SkRegion
> shape_
;
80 bool has_frame_color_
;
81 SkColor active_frame_color_
;
82 SkColor inactive_frame_color_
;
83 gfx::Size preferred_size_
;
85 // The class that registers for keyboard shortcuts for extension commands.
86 scoped_ptr
<ExtensionKeybindingRegistryViews
> extension_keybinding_registry_
;
88 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews
);
91 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_