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" |
11 #include "content/public/browser/notification_registrar.h" | |
Peter Kasting
2012/10/15 21:46:54
Nit: Alphabetical order
please use gerrit instead
2012/10/16 00:12:23
Done.
| |
12 #include "content/public/browser/notification_observer.h" | |
11 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
13 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
14 | 16 |
15 namespace content { | 17 namespace content { |
16 class WebContents; | 18 class WebContents; |
17 } | 19 } |
18 namespace views { | 20 namespace views { |
19 namespace internal { | 21 namespace internal { |
20 class NativeWidgetDelegate; | 22 class NativeWidgetDelegate; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 /////////////////////////////////////////////////////////////////////////////// | 54 /////////////////////////////////////////////////////////////////////////////// |
53 // ConstrainedWindowViews | 55 // ConstrainedWindowViews |
54 // | 56 // |
55 // A ConstrainedWindow implementation that implements a Constrained Window as | 57 // A ConstrainedWindow implementation that implements a Constrained Window as |
56 // a child HWND with a custom window frame. The ConstrainedWindowViews owns | 58 // a child HWND with a custom window frame. The ConstrainedWindowViews owns |
57 // itself and will be deleted soon after being closed. | 59 // itself and will be deleted soon after being closed. |
58 // | 60 // |
59 class ConstrainedWindowViews : public views::Widget, | 61 class ConstrainedWindowViews : public views::Widget, |
60 public ConstrainedWindow, | 62 public ConstrainedWindow, |
61 public NativeConstrainedWindowDelegate, | 63 public NativeConstrainedWindowDelegate, |
62 public content::WebContentsObserver { | 64 public content::WebContentsObserver, |
65 public content::NotificationObserver { | |
63 public: | 66 public: |
64 ConstrainedWindowViews(content::WebContents* web_contents, | 67 ConstrainedWindowViews(content::WebContents* web_contents, |
65 views::WidgetDelegate* widget_delegate, | 68 views::WidgetDelegate* widget_delegate, |
66 bool enable_chrome_style); | 69 bool enable_chrome_style, |
70 const gfx::Insets& client_insets); | |
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: |
82 void NotifyTabHelperWillClose(); | 86 void NotifyTabHelperWillClose(); |
83 | 87 |
84 // Overridden from views::Widget: | 88 // Overridden from views::Widget: |
85 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 89 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
86 | 90 |
87 // Overridden from NativeConstrainedWindowDelegate: | 91 // Overridden from NativeConstrainedWindowDelegate: |
88 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; | 92 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; |
89 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; | 93 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; |
90 virtual views::internal::NativeWidgetDelegate* | 94 virtual views::internal::NativeWidgetDelegate* |
91 AsNativeWidgetDelegate() OVERRIDE; | 95 AsNativeWidgetDelegate() OVERRIDE; |
92 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; | 96 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; |
93 | 97 |
94 // Set the top of the window to overlap the browser chrome. | 98 // Set the top of the window to overlap the browser chrome. |
95 void PositionChromeStyleWindow(); | 99 void PositionChromeStyleWindow(const gfx::Size& size); |
Peter Kasting
2012/10/15 21:46:54
Nit: While here it would be nice to put this above
please use gerrit instead
2012/10/16 00:12:23
Done.
| |
96 | 100 |
97 // Overridden from content::WebContentsObserver: | 101 // Overridden from content::WebContentsObserver: |
98 virtual void WebContentsDestroyed(content::WebContents* web_contents) | 102 virtual void WebContentsDestroyed(content::WebContents* web_contents) |
99 OVERRIDE; | 103 OVERRIDE; |
100 | 104 |
105 // content::NotificationObserver method override. | |
106 virtual void Observe(int type, | |
107 const content::NotificationSource& source, | |
108 const content::NotificationDetails& details) OVERRIDE; | |
109 | |
110 // A scoped container for notification registries. | |
Peter Kasting
2012/10/15 21:46:54
Nit: I'm not sure what "scoped" here means, and I
please use gerrit instead
2012/10/16 00:12:23
There're 9 instances of this exact comment above a
| |
111 content::NotificationRegistrar registrar_; | |
112 | |
101 content::WebContents* web_contents_; | 113 content::WebContents* web_contents_; |
102 | 114 |
103 NativeConstrainedWindow* native_constrained_window_; | |
104 | |
105 // TODO(wittman): remove once all constrained window dialogs are moved | 115 // TODO(wittman): remove once all constrained window dialogs are moved |
106 // over to Chrome style. | 116 // over to Chrome style. |
107 const bool enable_chrome_style_; | 117 const bool enable_chrome_style_; |
108 | 118 |
119 // Client insets for use when |enable_chrome_style_| is true. Empty insets | |
120 // provide no window decoration. The insets from | |
121 // ConstrainedWindow::GetDefaultInsets() provide enough insets for the title | |
122 // and the close button to be visible. | |
Peter Kasting
2012/10/15 21:46:54
Nit: What does "Empty insets provide no window dec
please use gerrit instead
2012/10/16 00:12:23
I have removed the discussion of GetDefaultInsets(
please use gerrit instead
2012/10/16 00:15:59
My last statement is ambigous. Here is a better ph
| |
123 const gfx::Insets client_insets_; | |
124 | |
125 NativeConstrainedWindow* native_constrained_window_; | |
126 | |
109 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); | 127 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); |
110 }; | 128 }; |
111 | 129 |
112 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 130 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
OLD | NEW |