| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONSTRAINED_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "content/browser/tab_contents/constrained_window.h" | 10 #include "content/browser/tab_contents/constrained_window.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 #include "views/window/window.h" |
| 13 | 14 |
| 14 class ConstrainedTabContentsWindowDelegate; | 15 class ConstrainedTabContentsWindowDelegate; |
| 15 class ConstrainedWindowAnimation; | 16 class ConstrainedWindowAnimation; |
| 16 class ConstrainedWindowFrameView; | 17 class ConstrainedWindowFrameView; |
| 17 namespace views { | 18 namespace views { |
| 19 namespace internal { |
| 20 class NativeWindowDelegate; |
| 21 } |
| 18 class NativeWindow; | 22 class NativeWindow; |
| 19 class NonClientFrameView; | 23 class NonClientFrameView; |
| 20 class Window; | 24 class Window; |
| 21 class WindowDelegate; | 25 class WindowDelegate; |
| 22 } | 26 } |
| 23 | 27 |
| 24 class NativeConstrainedWindowDelegate { | 28 class NativeConstrainedWindowDelegate { |
| 25 public: | 29 public: |
| 26 virtual ~NativeConstrainedWindowDelegate() {} | 30 virtual ~NativeConstrainedWindowDelegate() {} |
| 27 | 31 |
| 28 // Called after the NativeConstrainedWindow has been destroyed and is about to | 32 // Called after the NativeConstrainedWindow has been destroyed and is about to |
| 29 // be deleted. | 33 // be deleted. |
| 30 virtual void OnNativeConstrainedWindowDestroyed() = 0; | 34 virtual void OnNativeConstrainedWindowDestroyed() = 0; |
| 31 | 35 |
| 32 // Called when the NativeConstrainedWindow is clicked on when inactive. | 36 // Called when the NativeConstrainedWindow is clicked on when inactive. |
| 33 virtual void OnNativeConstrainedWindowMouseActivate() = 0; | 37 virtual void OnNativeConstrainedWindowMouseActivate() = 0; |
| 34 | 38 |
| 35 // Creates the frame view for the constrained window. | 39 // Creates the frame view for the constrained window. |
| 36 // TODO(beng): remove once ConstrainedWindowViews is-a views::Window. | 40 // TODO(beng): remove once ConstrainedWindowViews is-a views::Window. |
| 37 virtual views::NonClientFrameView* CreateFrameViewForWindow() = 0; | 41 virtual views::NonClientFrameView* CreateFrameViewForWindow() = 0; |
| 42 |
| 43 virtual views::internal::NativeWindowDelegate* AsNativeWindowDelegate() = 0; |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 class NativeConstrainedWindow { | 46 class NativeConstrainedWindow { |
| 41 public: | 47 public: |
| 42 virtual ~NativeConstrainedWindow() {} | 48 virtual ~NativeConstrainedWindow() {} |
| 43 | 49 |
| 44 // Creates a platform-specific implementation of NativeConstrainedWindow. | 50 // Creates a platform-specific implementation of NativeConstrainedWindow. |
| 45 static NativeConstrainedWindow* CreateNativeConstrainedWindow( | 51 static NativeConstrainedWindow* CreateNativeConstrainedWindow( |
| 46 NativeConstrainedWindowDelegate* delegate); | 52 NativeConstrainedWindowDelegate* delegate); |
| 47 | 53 |
| 48 virtual views::NativeWindow* AsNativeWindow() = 0; | 54 virtual views::NativeWindow* AsNativeWindow() = 0; |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 /////////////////////////////////////////////////////////////////////////////// | 57 /////////////////////////////////////////////////////////////////////////////// |
| 52 // ConstrainedWindowViews | 58 // ConstrainedWindowViews |
| 53 // | 59 // |
| 54 // A ConstrainedWindow implementation that implements a Constrained Window as | 60 // A ConstrainedWindow implementation that implements a Constrained Window as |
| 55 // a child HWND with a custom window frame. | 61 // a child HWND with a custom window frame. |
| 56 // | 62 // |
| 57 class ConstrainedWindowViews : public ConstrainedWindow, | 63 class ConstrainedWindowViews : public views::Window, |
| 64 public ConstrainedWindow, |
| 58 public NativeConstrainedWindowDelegate { | 65 public NativeConstrainedWindowDelegate { |
| 59 public: | 66 public: |
| 60 ConstrainedWindowViews(TabContents* owner, | 67 ConstrainedWindowViews(TabContents* owner, |
| 61 views::WindowDelegate* window_delegate); | 68 views::WindowDelegate* window_delegate); |
| 62 virtual ~ConstrainedWindowViews(); | 69 virtual ~ConstrainedWindowViews(); |
| 63 | 70 |
| 64 // Returns the TabContents that constrains this Constrained Window. | 71 // Returns the TabContents that constrains this Constrained Window. |
| 65 TabContents* owner() const { return owner_; } | 72 TabContents* owner() const { return owner_; } |
| 66 | 73 |
| 67 views::Window* GetWindow(); | 74 views::Window* GetWindow(); |
| 68 | 75 |
| 69 // Overridden from ConstrainedWindow: | 76 // Overridden from ConstrainedWindow: |
| 70 virtual void ShowConstrainedWindow() OVERRIDE; | 77 virtual void ShowConstrainedWindow() OVERRIDE; |
| 71 virtual void CloseConstrainedWindow() OVERRIDE; | 78 virtual void CloseConstrainedWindow() OVERRIDE; |
| 72 virtual void FocusConstrainedWindow() OVERRIDE; | 79 virtual void FocusConstrainedWindow() OVERRIDE; |
| 73 | 80 |
| 74 private: | 81 private: |
| 82 // Overridden from views::Window: |
| 83 virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; |
| 84 |
| 75 // Overridden from NativeConstrainedWindowDelegate: | 85 // Overridden from NativeConstrainedWindowDelegate: |
| 76 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; | 86 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; |
| 77 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; | 87 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; |
| 78 virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; | 88 virtual views::internal::NativeWindowDelegate* |
| 89 AsNativeWindowDelegate() OVERRIDE; |
| 79 | 90 |
| 80 // The TabContents that owns and constrains this ConstrainedWindow. | 91 // The TabContents that owns and constrains this ConstrainedWindow. |
| 81 TabContents* owner_; | 92 TabContents* owner_; |
| 82 | 93 |
| 83 NativeConstrainedWindow* native_constrained_window_; | 94 NativeConstrainedWindow* native_constrained_window_; |
| 84 | 95 |
| 85 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); | 96 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); |
| 86 }; | 97 }; |
| 87 | 98 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| OLD | NEW |