| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APPS_NATIVE_APP_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
| 7 | 7 |
| 8 #include "apps/native_app_window.h" | 8 #include "apps/native_app_window.h" |
| 9 #include "apps/shell_window.h" | 9 #include "apps/shell_window.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.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/controls/webview/unhandled_keyboard_event_handler.h" | 15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
| 17 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "chrome/browser/shell_integration.h" | 20 #include "chrome/browser/shell_integration.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 class ExtensionKeybindingRegistryViews; | 23 class ExtensionKeybindingRegistryViews; |
| 24 class Profile; | 24 class Profile; |
| 25 | 25 |
| 26 namespace apps { |
| 27 class ShellWindowFrameView; |
| 28 } |
| 29 |
| 26 namespace content { | 30 namespace content { |
| 27 class RenderViewHost; | 31 class RenderViewHost; |
| 28 class WebContents; | 32 class WebContents; |
| 29 } | 33 } |
| 30 | 34 |
| 31 namespace extensions { | 35 namespace extensions { |
| 32 class Extension; | 36 class Extension; |
| 33 } | 37 } |
| 34 | 38 |
| 35 namespace views { | 39 namespace views { |
| 36 class WebView; | 40 class WebView; |
| 37 } | 41 } |
| 38 | 42 |
| 39 class NativeAppWindowViews : public apps::NativeAppWindow, | 43 class NativeAppWindowViews : public apps::NativeAppWindow, |
| 40 public views::WidgetDelegateView, | 44 public views::WidgetDelegateView, |
| 41 public views::WidgetObserver, | 45 public views::WidgetObserver, |
| 42 public content::WebContentsObserver { | 46 public content::WebContentsObserver { |
| 43 public: | 47 public: |
| 44 NativeAppWindowViews(apps::ShellWindow* shell_window, | 48 NativeAppWindowViews(apps::ShellWindow* shell_window, |
| 45 const apps::ShellWindow::CreateParams& params); | 49 const apps::ShellWindow::CreateParams& params); |
| 46 virtual ~NativeAppWindowViews(); | 50 virtual ~NativeAppWindowViews(); |
| 47 | 51 |
| 48 bool frameless() const { return frameless_; } | |
| 49 SkRegion* draggable_region() { return draggable_region_.get(); } | |
| 50 | |
| 51 private: | 52 private: |
| 52 void InitializeDefaultWindow( | 53 void InitializeDefaultWindow( |
| 53 const apps::ShellWindow::CreateParams& create_params); | 54 const apps::ShellWindow::CreateParams& create_params); |
| 54 void InitializePanelWindow( | 55 void InitializePanelWindow( |
| 55 const apps::ShellWindow::CreateParams& create_params); | 56 const apps::ShellWindow::CreateParams& create_params); |
| 56 void OnViewWasResized(); | 57 void OnViewWasResized(); |
| 57 | 58 |
| 58 bool ShouldUseChromeStyleFrame() const; | 59 bool ShouldUseChromeStyleFrame() const; |
| 59 | 60 |
| 61 // Caller owns the returned object. |
| 62 apps::ShellWindowFrameView* CreateShellWindowFrameView(); |
| 63 |
| 60 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 61 void OnShortcutInfoLoaded( | 65 void OnShortcutInfoLoaded( |
| 62 const ShellIntegration::ShortcutInfo& shortcut_info); | 66 const ShellIntegration::ShortcutInfo& shortcut_info); |
| 63 HWND GetNativeAppWindowHWND() const; | 67 HWND GetNativeAppWindowHWND() const; |
| 64 #endif | 68 #endif |
| 65 | 69 |
| 66 // ui::BaseWindow implementation. | 70 // ui::BaseWindow implementation. |
| 67 virtual bool IsActive() const OVERRIDE; | 71 virtual bool IsActive() const OVERRIDE; |
| 68 virtual bool IsMaximized() const OVERRIDE; | 72 virtual bool IsMaximized() const OVERRIDE; |
| 69 virtual bool IsMinimized() const OVERRIDE; | 73 virtual bool IsMinimized() const OVERRIDE; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 138 |
| 135 // NativeAppWindow implementation. | 139 // NativeAppWindow implementation. |
| 136 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 140 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 137 virtual bool IsFullscreenOrPending() const OVERRIDE; | 141 virtual bool IsFullscreenOrPending() const OVERRIDE; |
| 138 virtual bool IsDetached() const OVERRIDE; | 142 virtual bool IsDetached() const OVERRIDE; |
| 139 virtual void UpdateWindowIcon() OVERRIDE; | 143 virtual void UpdateWindowIcon() OVERRIDE; |
| 140 virtual void UpdateWindowTitle() OVERRIDE; | 144 virtual void UpdateWindowTitle() OVERRIDE; |
| 141 virtual void UpdateInputRegion(scoped_ptr<SkRegion> region) OVERRIDE; | 145 virtual void UpdateInputRegion(scoped_ptr<SkRegion> region) OVERRIDE; |
| 142 virtual void UpdateDraggableRegions( | 146 virtual void UpdateDraggableRegions( |
| 143 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | 147 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
| 148 virtual SkRegion* GetDraggableRegion() const OVERRIDE; |
| 144 virtual void HandleKeyboardEvent( | 149 virtual void HandleKeyboardEvent( |
| 145 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 150 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 151 virtual bool IsFrameless() const OVERRIDE; |
| 146 virtual gfx::Insets GetFrameInsets() const OVERRIDE; | 152 virtual gfx::Insets GetFrameInsets() const OVERRIDE; |
| 147 virtual bool IsVisible() const OVERRIDE; | 153 virtual bool IsVisible() const OVERRIDE; |
| 148 virtual void HideWithApp() OVERRIDE; | 154 virtual void HideWithApp() OVERRIDE; |
| 149 virtual void ShowWithApp() OVERRIDE; | 155 virtual void ShowWithApp() OVERRIDE; |
| 150 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; | 156 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; |
| 151 | 157 |
| 152 // web_modal::WebContentsModalDialogHost implementation. | 158 // web_modal::WebContentsModalDialogHost implementation. |
| 153 virtual gfx::NativeView GetHostView() const OVERRIDE; | 159 virtual gfx::NativeView GetHostView() const OVERRIDE; |
| 154 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; | 160 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; |
| 155 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; | 161 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 196 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
| 191 | 197 |
| 192 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; | 198 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; |
| 193 | 199 |
| 194 ObserverList<web_modal::ModalDialogHostObserver> observer_list_; | 200 ObserverList<web_modal::ModalDialogHostObserver> observer_list_; |
| 195 | 201 |
| 196 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); | 202 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
| 197 }; | 203 }; |
| 198 | 204 |
| 199 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ | 205 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
| OLD | NEW |