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_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 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/ui/constrained_window.h" | 9 #include "chrome/browser/ui/constrained_window.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 // | 54 // |
55 // A ConstrainedWindow implementation that implements a Constrained Window as | 55 // A ConstrainedWindow implementation that implements a Constrained Window as |
56 // a child HWND with a custom window frame. The ConstrainedWindowViews owns | 56 // a child HWND with a custom window frame. The ConstrainedWindowViews owns |
57 // itself and will be deleted soon after being closed. | 57 // itself and will be deleted soon after being closed. |
58 // | 58 // |
59 class ConstrainedWindowViews : public views::Widget, | 59 class ConstrainedWindowViews : public views::Widget, |
60 public ConstrainedWindow, | 60 public ConstrainedWindow, |
61 public NativeConstrainedWindowDelegate, | 61 public NativeConstrainedWindowDelegate, |
62 public content::WebContentsObserver { | 62 public content::WebContentsObserver { |
63 public: | 63 public: |
64 ConstrainedWindowViews(content::WebContents* web_contents, | 64 ConstrainedWindowViews(content::WebContents* web_contents, |
Peter Kasting
2012/10/12 03:23:32
Seems like we can avoid having two constructors an
please use gerrit instead
2012/10/14 18:40:45
Done. Since the default insets are not [0,0,0,0],
| |
65 views::WidgetDelegate* widget_delegate, | 65 views::WidgetDelegate* widget_delegate, |
66 bool enable_chrome_style, | |
67 const gfx::Insets& client_insets); | |
68 ConstrainedWindowViews(content::WebContents* web_contents, | |
69 views::WidgetDelegate* widget_delegate, | |
66 bool enable_chrome_style); | 70 bool enable_chrome_style); |
67 virtual ~ConstrainedWindowViews(); | 71 virtual ~ConstrainedWindowViews(); |
68 | 72 |
69 // Returns the WebContents that constrains this Constrained Window. | 73 // Returns the WebContents that constrains this Constrained Window. |
70 content::WebContents* owner() const { return web_contents_; } | 74 content::WebContents* owner() const { return web_contents_; } |
71 | 75 |
72 // Overridden from ConstrainedWindow: | 76 // Overridden from ConstrainedWindow: |
73 virtual void ShowConstrainedWindow() OVERRIDE; | 77 virtual void ShowConstrainedWindow() OVERRIDE; |
74 virtual void CloseConstrainedWindow() OVERRIDE; | 78 virtual void CloseConstrainedWindow() OVERRIDE; |
75 virtual void FocusConstrainedWindow() OVERRIDE; | 79 virtual void FocusConstrainedWindow() OVERRIDE; |
76 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 80 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
77 | 81 |
78 // Overridden from views::Widget: | 82 // Overridden from views::Widget: |
79 void CenterWindow(const gfx::Size& size); | 83 void CenterWindow(const gfx::Size& size); |
80 | 84 |
81 private: | 85 private: |
86 void InitConstrainedWindowViews(views::WidgetDelegate* widget_delegate); | |
82 void NotifyTabHelperWillClose(); | 87 void NotifyTabHelperWillClose(); |
83 | 88 |
84 // Overridden from views::Widget: | 89 // Overridden from views::Widget: |
85 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 90 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
86 | 91 |
87 // Overridden from NativeConstrainedWindowDelegate: | 92 // Overridden from NativeConstrainedWindowDelegate: |
88 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; | 93 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; |
89 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; | 94 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; |
90 virtual views::internal::NativeWidgetDelegate* | 95 virtual views::internal::NativeWidgetDelegate* |
91 AsNativeWidgetDelegate() OVERRIDE; | 96 AsNativeWidgetDelegate() OVERRIDE; |
92 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; | 97 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; |
93 | 98 |
94 // Set the top of the window to overlap the browser chrome. | 99 // Set the top of the window to overlap the browser chrome. |
95 void PositionChromeStyleWindow(); | 100 void PositionChromeStyleWindow(); |
96 | 101 |
97 // Overridden from content::WebContentsObserver: | 102 // Overridden from content::WebContentsObserver: |
98 virtual void WebContentsDestroyed(content::WebContents* web_contents) | 103 virtual void WebContentsDestroyed(content::WebContents* web_contents) |
99 OVERRIDE; | 104 OVERRIDE; |
100 | 105 |
101 content::WebContents* web_contents_; | 106 content::WebContents* web_contents_; |
102 | 107 |
103 NativeConstrainedWindow* native_constrained_window_; | |
104 | |
105 // TODO(wittman): remove once all constrained window dialogs are moved | 108 // TODO(wittman): remove once all constrained window dialogs are moved |
106 // over to Chrome style. | 109 // over to Chrome style. |
107 const bool enable_chrome_style_; | 110 const bool enable_chrome_style_; |
108 | 111 |
112 // Whether the window has custom client insets. | |
113 const bool custom_client_insets_; | |
114 | |
115 // Custom client insets. | |
116 const gfx::Insets client_insets_; | |
117 | |
118 NativeConstrainedWindow* native_constrained_window_; | |
119 | |
109 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); | 120 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); |
110 }; | 121 }; |
111 | 122 |
112 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 123 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
OLD | NEW |