| 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_NATIVE_APP_WINDOW_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/base_window.h" | 8 #include "chrome/browser/ui/base_window.h" |
| 9 #include "chrome/browser/ui/extensions/native_shell_window.h" | 9 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 10 #include "chrome/browser/ui/extensions/shell_window.h" | 10 #include "chrome/browser/ui/extensions/shell_window.h" |
| 11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
| 12 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
| 13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
| 16 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
| 17 | 17 |
| 18 class ExtensionKeybindingRegistryViews; | 18 class ExtensionKeybindingRegistryViews; |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class WebContents; | 22 class WebContents; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 class Extension; | 26 class Extension; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace views { | 29 namespace views { |
| 30 class WebView; | 30 class WebView; |
| 31 } | 31 } |
| 32 | 32 |
| 33 class ShellWindowViews : public NativeShellWindow, | 33 class NativeAppWindowViews : public NativeAppWindow, |
| 34 public views::WidgetDelegateView, | 34 public views::WidgetDelegateView, |
| 35 public views::WidgetObserver { | 35 public views::WidgetObserver { |
| 36 public: | 36 public: |
| 37 ShellWindowViews(ShellWindow* shell_window, | 37 NativeAppWindowViews(ShellWindow* shell_window, |
| 38 const ShellWindow::CreateParams& params); | 38 const ShellWindow::CreateParams& params); |
| 39 | 39 |
| 40 bool frameless() const { return frameless_; } | 40 bool frameless() const { return frameless_; } |
| 41 SkRegion* draggable_region() { return draggable_region_.get(); } | 41 SkRegion* draggable_region() { return draggable_region_.get(); } |
| 42 | 42 |
| 43 // BaseWindow implementation. | 43 // BaseWindow implementation. |
| 44 virtual bool IsActive() const OVERRIDE; | 44 virtual bool IsActive() const OVERRIDE; |
| 45 virtual bool IsMaximized() const OVERRIDE; | 45 virtual bool IsMaximized() const OVERRIDE; |
| 46 virtual bool IsMinimized() const OVERRIDE; | 46 virtual bool IsMinimized() const OVERRIDE; |
| 47 virtual bool IsFullscreen() const OVERRIDE; | 47 virtual bool IsFullscreen() const OVERRIDE; |
| 48 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 48 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return shell_window_->extension(); | 103 return shell_window_->extension(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // views::WidgetDelegate implementation. | 106 // views::WidgetDelegate implementation. |
| 107 virtual void SaveWindowPlacement(const gfx::Rect& bounds, | 107 virtual void SaveWindowPlacement(const gfx::Rect& bounds, |
| 108 ui::WindowShowState show_state) OVERRIDE; | 108 ui::WindowShowState show_state) OVERRIDE; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 friend class ShellWindowFrameView; | 111 friend class ShellWindowFrameView; |
| 112 | 112 |
| 113 virtual ~ShellWindowViews(); | 113 virtual ~NativeAppWindowViews(); |
| 114 | 114 |
| 115 // NativeShellWindow implementation. | 115 // NativeAppWindow implementation. |
| 116 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 116 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 117 virtual bool IsFullscreenOrPending() const OVERRIDE; | 117 virtual bool IsFullscreenOrPending() const OVERRIDE; |
| 118 virtual void UpdateWindowIcon() OVERRIDE; | 118 virtual void UpdateWindowIcon() OVERRIDE; |
| 119 virtual void UpdateWindowTitle() OVERRIDE; | 119 virtual void UpdateWindowTitle() OVERRIDE; |
| 120 virtual void UpdateDraggableRegions( | 120 virtual void UpdateDraggableRegions( |
| 121 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | 121 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
| 122 virtual void HandleKeyboardEvent( | 122 virtual void HandleKeyboardEvent( |
| 123 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 123 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 124 virtual void RenderViewHostChanged() OVERRIDE; | 124 virtual void RenderViewHostChanged() OVERRIDE; |
| 125 | 125 |
| 126 void OnViewWasResized(); | 126 void OnViewWasResized(); |
| 127 | 127 |
| 128 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow. | 128 ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. |
| 129 | 129 |
| 130 views::WebView* web_view_; | 130 views::WebView* web_view_; |
| 131 views::Widget* window_; | 131 views::Widget* window_; |
| 132 bool is_fullscreen_; | 132 bool is_fullscreen_; |
| 133 | 133 |
| 134 scoped_ptr<SkRegion> draggable_region_; | 134 scoped_ptr<SkRegion> draggable_region_; |
| 135 | 135 |
| 136 bool frameless_; | 136 bool frameless_; |
| 137 gfx::Size minimum_size_; | 137 gfx::Size minimum_size_; |
| 138 gfx::Size maximum_size_; | 138 gfx::Size maximum_size_; |
| 139 | 139 |
| 140 // The class that registers for keyboard shortcuts for extension commands. | 140 // The class that registers for keyboard shortcuts for extension commands. |
| 141 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 141 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
| 142 | 142 |
| 143 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 143 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); | 145 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 148 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
| OLD | NEW |