OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_CONSTRAINED_WINDOW_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CONSTRAINED_WINDOW_IMPL_H_ |
6 #define CHROME_BROWSER_CONSTRAINED_WINDOW_IMPL_H_ | 6 #define CHROME_BROWSER_CONSTRAINED_WINDOW_IMPL_H_ |
7 | 7 |
8 #include "base/gfx/rect.h" | 8 #include "base/gfx/rect.h" |
9 #include "chrome/browser/tab_contents/constrained_window.h" | 9 #include "chrome/browser/tab_contents/constrained_window.h" |
10 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 10 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
11 #include "chrome/views/custom_frame_window.h" | 11 #include "chrome/views/window.h" |
12 | 12 |
13 class ConstrainedTabContentsWindowDelegate; | 13 class ConstrainedTabContentsWindowDelegate; |
14 class ConstrainedWindowAnimation; | 14 class ConstrainedWindowAnimation; |
15 class ConstrainedWindowNonClientView; | 15 class ConstrainedWindowFrameView; |
16 namespace views { | 16 namespace views { |
17 class HWNDView; | 17 class HWNDView; |
18 class WindowDelegate; | 18 class WindowDelegate; |
19 } | 19 } |
20 | 20 |
21 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
22 // ConstrainedWindowImpl | 22 // ConstrainedWindowImpl |
23 // | 23 // |
24 // A ConstrainedWindow implementation that implements a Constrained Window as | 24 // A ConstrainedWindow implementation that implements a Constrained Window as |
25 // a child HWND with a custom window frame. | 25 // a child HWND with a custom window frame. |
26 // | 26 // |
27 class ConstrainedWindowImpl : public ConstrainedWindow, | 27 class ConstrainedWindowImpl : public ConstrainedWindow, |
28 public views::CustomFrameWindow { | 28 public views::Window { |
29 public: | 29 public: |
30 virtual ~ConstrainedWindowImpl(); | 30 virtual ~ConstrainedWindowImpl(); |
31 | 31 |
32 // Returns the TabContents that constrains this Constrained Window. | 32 // Returns the TabContents that constrains this Constrained Window. |
33 TabContents* owner() const { return owner_; } | 33 TabContents* owner() const { return owner_; } |
34 | 34 |
35 // Returns the non-client view inside this Constrained Window. | 35 // Overridden from views::Window: |
36 // NOTE: Defining the function body here would require pulling in the | 36 virtual views::NonClientFrameView* CreateFrameViewForWindow(); |
37 // declarations of ConstrainedWindowNonClientView, as well as all the classes | |
38 // it depends on, from the .cc file; the benefit isn't worth it. | |
39 ConstrainedWindowNonClientView* non_client_view(); | |
40 | |
41 // Overridden from views::CustomFrameWindow: | |
42 virtual void UpdateWindowTitle(); | 37 virtual void UpdateWindowTitle(); |
43 | 38 |
44 // Overridden from ConstrainedWindow: | 39 // Overridden from ConstrainedWindow: |
45 virtual void CloseConstrainedWindow(); | 40 virtual void CloseConstrainedWindow(); |
46 virtual void ActivateConstrainedWindow(); | 41 virtual void ActivateConstrainedWindow(); |
47 virtual void RepositionConstrainedWindowTo(const gfx::Point& anchor_point) {} | 42 virtual void RepositionConstrainedWindowTo(const gfx::Point& anchor_point) {} |
48 virtual void WasHidden(); | 43 virtual void WasHidden(); |
49 virtual void DidBecomeSelected(); | 44 virtual void DidBecomeSelected(); |
50 virtual std::wstring GetWindowTitle() const; | 45 virtual std::wstring GetWindowTitle() const; |
51 virtual const gfx::Rect& GetCurrentBounds() const; | 46 virtual const gfx::Rect& GetCurrentBounds() const; |
52 | 47 |
53 protected: | 48 protected: |
54 // Windows message handlers: | 49 // Windows message handlers: |
55 virtual void OnDestroy(); | 50 virtual void OnDestroy(); |
56 virtual void OnFinalMessage(HWND window); | 51 virtual void OnFinalMessage(HWND window); |
57 virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message); | 52 virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message); |
58 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); | 53 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); |
59 | 54 |
60 private: | 55 private: |
61 friend class ConstrainedWindow; | 56 friend class ConstrainedWindow; |
62 | 57 |
63 // Use the static factory methods on ConstrainedWindow to construct a | 58 // Use the static factory methods on ConstrainedWindow to construct a |
64 // ConstrainedWindow. | 59 // ConstrainedWindow. |
65 ConstrainedWindowImpl(TabContents* owner, | 60 ConstrainedWindowImpl(TabContents* owner, |
66 views::WindowDelegate* window_delegate); | 61 views::WindowDelegate* window_delegate); |
67 void Init(TabContents* owner); | 62 void Init(); |
68 | 63 |
69 // Initialize the Constrained Window as a Constrained Dialog containing a | 64 // Initialize the Constrained Window as a Constrained Dialog containing a |
70 // views::View client area. | 65 // views::View client area. |
71 void InitAsDialog(const gfx::Rect& initial_bounds); | 66 void InitAsDialog(const gfx::Rect& initial_bounds); |
72 | 67 |
73 // Updates the portions of the UI as specified in |changed_flags|. | 68 // Updates the portions of the UI as specified in |changed_flags|. |
74 void UpdateUI(unsigned int changed_flags); | 69 void UpdateUI(unsigned int changed_flags); |
75 | 70 |
76 // The TabContents that owns and constrains this ConstrainedWindow. | 71 // The TabContents that owns and constrains this ConstrainedWindow. |
77 TabContents* owner_; | 72 TabContents* owner_; |
(...skipping 10 matching lines...) Expand all Loading... |
88 // the constrained title bar. | 83 // the constrained title bar. |
89 gfx::Point anchor_point_; | 84 gfx::Point anchor_point_; |
90 | 85 |
91 // Current display rectangle (relative to owner_'s visible area). | 86 // Current display rectangle (relative to owner_'s visible area). |
92 gfx::Rect current_bounds_; | 87 gfx::Rect current_bounds_; |
93 | 88 |
94 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowImpl); | 89 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowImpl); |
95 }; | 90 }; |
96 | 91 |
97 #endif // #ifndef CHROME_BROWSER_CONSTRAINED_WINDOW_IMPL_H_ | 92 #endif // #ifndef CHROME_BROWSER_CONSTRAINED_WINDOW_IMPL_H_ |
OLD | NEW |