| 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/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_shell_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 "content/public/browser/web_contents_observer.h" |
| 12 #include "third_party/skia/include/core/SkRegion.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
| 13 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
| 14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 15 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
| 16 | 17 |
| 17 class ExtensionKeybindingRegistryViews; | 18 class ExtensionKeybindingRegistryViews; |
| 18 class Profile; | 19 class Profile; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 22 class RenderViewHost; |
| 21 class WebContents; | 23 class WebContents; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace extensions { | 26 namespace extensions { |
| 25 class Extension; | 27 class Extension; |
| 26 struct DraggableRegion; | 28 struct DraggableRegion; |
| 27 } | 29 } |
| 28 | 30 |
| 29 namespace views { | 31 namespace views { |
| 30 class WebView; | 32 class WebView; |
| 31 } | 33 } |
| 32 | 34 |
| 33 class ShellWindowViews : public NativeShellWindow, | 35 class ShellWindowViews : public NativeShellWindow, |
| 34 public views::WidgetDelegateView { | 36 public views::WidgetDelegateView, |
| 37 public content::WebContentsObserver { |
| 35 public: | 38 public: |
| 36 ShellWindowViews(ShellWindow* shell_window, | 39 ShellWindowViews(ShellWindow* shell_window, |
| 37 const ShellWindow::CreateParams& params); | 40 const ShellWindow::CreateParams& params); |
| 38 | 41 |
| 39 bool frameless() const { return frameless_; } | 42 bool frameless() const { return frameless_; } |
| 40 SkRegion* draggable_region() { return draggable_region_.get(); } | 43 SkRegion* draggable_region() { return draggable_region_.get(); } |
| 41 | 44 |
| 42 // BaseWindow implementation. | 45 // BaseWindow implementation. |
| 43 virtual bool IsActive() const OVERRIDE; | 46 virtual bool IsActive() const OVERRIDE; |
| 44 virtual bool IsMaximized() const OVERRIDE; | 47 virtual bool IsMaximized() const OVERRIDE; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 70 virtual string16 GetWindowTitle() const OVERRIDE; | 73 virtual string16 GetWindowTitle() const OVERRIDE; |
| 71 virtual void DeleteDelegate() OVERRIDE; | 74 virtual void DeleteDelegate() OVERRIDE; |
| 72 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 75 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 73 virtual bool ShouldDescendIntoChildForEventHandling( | 76 virtual bool ShouldDescendIntoChildForEventHandling( |
| 74 gfx::NativeView child, | 77 gfx::NativeView child, |
| 75 const gfx::Point& location) OVERRIDE; | 78 const gfx::Point& location) OVERRIDE; |
| 76 virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; | 79 virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; |
| 77 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; | 80 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
| 78 virtual bool ShouldShowWindowTitle() const OVERRIDE; | 81 virtual bool ShouldShowWindowTitle() const OVERRIDE; |
| 79 | 82 |
| 83 // WebContentsObserver implementation. |
| 84 virtual void RenderViewCreated( |
| 85 content::RenderViewHost* render_view_host) OVERRIDE; |
| 86 |
| 80 protected: | 87 protected: |
| 81 // views::View implementation. | 88 // views::View implementation. |
| 82 virtual void Layout() OVERRIDE; | 89 virtual void Layout() OVERRIDE; |
| 83 virtual void ViewHierarchyChanged( | 90 virtual void ViewHierarchyChanged( |
| 84 bool is_add, views::View *parent, views::View *child) OVERRIDE; | 91 bool is_add, views::View *parent, views::View *child) OVERRIDE; |
| 85 virtual gfx::Size GetMinimumSize() OVERRIDE; | 92 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 86 virtual gfx::Size GetMaximumSize() OVERRIDE; | 93 virtual gfx::Size GetMaximumSize() OVERRIDE; |
| 87 virtual void OnFocus() OVERRIDE; | 94 virtual void OnFocus() OVERRIDE; |
| 88 | 95 |
| 89 Profile* profile() { return shell_window_->profile(); } | 96 Profile* profile() { return shell_window_->profile(); } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 118 void OnViewWasResized(); | 125 void OnViewWasResized(); |
| 119 | 126 |
| 120 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow. | 127 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow. |
| 121 | 128 |
| 122 views::WebView* web_view_; | 129 views::WebView* web_view_; |
| 123 views::Widget* window_; | 130 views::Widget* window_; |
| 124 bool is_fullscreen_; | 131 bool is_fullscreen_; |
| 125 | 132 |
| 126 scoped_ptr<SkRegion> draggable_region_; | 133 scoped_ptr<SkRegion> draggable_region_; |
| 127 | 134 |
| 128 bool frameless_; | 135 const bool frameless_; |
| 136 const bool transparent_background_; |
| 129 gfx::Size minimum_size_; | 137 gfx::Size minimum_size_; |
| 130 gfx::Size maximum_size_; | 138 gfx::Size maximum_size_; |
| 131 | 139 |
| 132 // The class that registers for keyboard shortcuts for extension commands. | 140 // The class that registers for keyboard shortcuts for extension commands. |
| 133 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 141 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
| 134 | 142 |
| 135 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 143 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
| 136 | 144 |
| 137 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); | 145 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); |
| 138 }; | 146 }; |
| 139 | 147 |
| 140 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 148 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
| OLD | NEW |