OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
7 | 7 |
8 #include "chrome/browser/ui/extensions/shell_window.h" | 8 #include "chrome/browser/ui/extensions/shell_window.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/scoped_sk_region.h" | 10 #include "ui/gfx/scoped_sk_region.h" |
11 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 class Extension; | 16 class Extension; |
| 17 struct DraggableRegion; |
17 } | 18 } |
18 | 19 |
19 namespace views { | 20 namespace views { |
20 class WebView; | 21 class WebView; |
21 } | 22 } |
22 | 23 |
23 class ShellWindowViews : public ShellWindow, | 24 class ShellWindowViews : public ShellWindow, |
24 public views::WidgetDelegateView { | 25 public views::WidgetDelegateView { |
25 public: | 26 public: |
26 ShellWindowViews(Profile* profile, | 27 ShellWindowViews(Profile* profile, |
27 const extensions::Extension* extension, | 28 const extensions::Extension* extension, |
28 const GURL& url, | 29 const GURL& url, |
29 const CreateParams& params); | 30 const CreateParams& params); |
30 | 31 |
| 32 bool frameless() const { return frameless_; } |
| 33 SkRegion* draggable_region() { return draggable_region_.Get(); } |
| 34 |
31 // BaseWindow implementation. | 35 // BaseWindow implementation. |
32 virtual bool IsActive() const OVERRIDE; | 36 virtual bool IsActive() const OVERRIDE; |
33 virtual bool IsMaximized() const OVERRIDE; | 37 virtual bool IsMaximized() const OVERRIDE; |
34 virtual bool IsMinimized() const OVERRIDE; | 38 virtual bool IsMinimized() const OVERRIDE; |
35 virtual bool IsFullscreen() const OVERRIDE; | 39 virtual bool IsFullscreen() const OVERRIDE; |
36 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 40 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
37 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 41 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
38 virtual gfx::Rect GetBounds() const OVERRIDE; | 42 virtual gfx::Rect GetBounds() const OVERRIDE; |
39 virtual void Show() OVERRIDE; | 43 virtual void Show() OVERRIDE; |
40 virtual void ShowInactive() OVERRIDE; | 44 virtual void ShowInactive() OVERRIDE; |
41 virtual void Close() OVERRIDE; | 45 virtual void Close() OVERRIDE; |
42 virtual void Activate() OVERRIDE; | 46 virtual void Activate() OVERRIDE; |
43 virtual void Deactivate() OVERRIDE; | 47 virtual void Deactivate() OVERRIDE; |
44 virtual void Maximize() OVERRIDE; | 48 virtual void Maximize() OVERRIDE; |
45 virtual void Minimize() OVERRIDE; | 49 virtual void Minimize() OVERRIDE; |
46 virtual void Restore() OVERRIDE; | 50 virtual void Restore() OVERRIDE; |
47 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 51 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
48 virtual void SetDraggableRegion(SkRegion* region) OVERRIDE; | |
49 virtual void FlashFrame(bool flash) OVERRIDE; | 52 virtual void FlashFrame(bool flash) OVERRIDE; |
50 virtual bool IsAlwaysOnTop() const OVERRIDE; | 53 virtual bool IsAlwaysOnTop() const OVERRIDE; |
51 | 54 |
52 // WidgetDelegate implementation. | 55 // WidgetDelegate implementation. |
53 virtual views::View* GetContentsView() OVERRIDE; | 56 virtual views::View* GetContentsView() OVERRIDE; |
54 virtual views::NonClientFrameView* CreateNonClientFrameView( | 57 virtual views::NonClientFrameView* CreateNonClientFrameView( |
55 views::Widget* widget) OVERRIDE; | 58 views::Widget* widget) OVERRIDE; |
56 virtual bool CanResize() const OVERRIDE; | 59 virtual bool CanResize() const OVERRIDE; |
57 virtual bool CanMaximize() const OVERRIDE; | 60 virtual bool CanMaximize() const OVERRIDE; |
58 virtual views::Widget* GetWidget() OVERRIDE; | 61 virtual views::Widget* GetWidget() OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
73 // ShellWindow implementation. | 76 // ShellWindow implementation. |
74 virtual void UpdateWindowTitle() OVERRIDE; | 77 virtual void UpdateWindowTitle() OVERRIDE; |
75 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 78 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
76 virtual bool IsFullscreenOrPending() const OVERRIDE; | 79 virtual bool IsFullscreenOrPending() const OVERRIDE; |
77 | 80 |
78 private: | 81 private: |
79 friend class ShellWindowFrameView; | 82 friend class ShellWindowFrameView; |
80 | 83 |
81 virtual ~ShellWindowViews(); | 84 virtual ~ShellWindowViews(); |
82 | 85 |
| 86 // content::WebContentsDelegate implementation. |
| 87 virtual void UpdateDraggableRegions( |
| 88 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
| 89 |
83 void OnViewWasResized(); | 90 void OnViewWasResized(); |
84 | 91 |
85 views::WebView* web_view_; | 92 views::WebView* web_view_; |
86 views::Widget* window_; | 93 views::Widget* window_; |
87 bool is_fullscreen_; | 94 bool is_fullscreen_; |
88 | 95 |
89 gfx::ScopedSkRegion caption_region_; | 96 gfx::ScopedSkRegion draggable_region_; |
90 | 97 |
91 bool use_custom_frame_; | 98 bool frameless_; |
92 gfx::Size minimum_size_; | 99 gfx::Size minimum_size_; |
93 gfx::Size maximum_size_; | 100 gfx::Size maximum_size_; |
94 | 101 |
95 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); | 102 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); |
96 }; | 103 }; |
97 | 104 |
98 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 105 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
OLD | NEW |