Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: views/window/non_client_view.cc

Issue 7054052: Move more from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/window/native_window_win.cc ('k') | views/window/window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "views/window/non_client_view.h" 5 #include "views/window/non_client_view.h"
6 6
7 #include "ui/base/accessibility/accessible_view_state.h" 7 #include "ui/base/accessibility/accessible_view_state.h"
8 #include "views/widget/root_view.h" 8 #include "views/widget/root_view.h"
9 #include "views/widget/widget.h" 9 #include "views/widget/widget.h"
10 #include "views/window/client_view.h" 10 #include "views/window/client_view.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 frame_view_.reset(frame_view); 53 frame_view_.reset(frame_view);
54 if (parent()) 54 if (parent())
55 AddChildViewAt(frame_view_.get(), kFrameViewIndex); 55 AddChildViewAt(frame_view_.get(), kFrameViewIndex);
56 } 56 }
57 57
58 bool NonClientView::CanClose() { 58 bool NonClientView::CanClose() {
59 return client_view_->CanClose(); 59 return client_view_->CanClose();
60 } 60 }
61 61
62 void NonClientView::WindowClosing() { 62 void NonClientView::WindowClosing() {
63 client_view_->WindowClosing(); 63 client_view_->WidgetClosing();
64 } 64 }
65 65
66 void NonClientView::UpdateFrame() { 66 void NonClientView::UpdateFrame() {
67 Widget* widget = GetWidget(); 67 Widget* widget = GetWidget();
68 SetFrameView(widget->CreateNonClientFrameView()); 68 SetFrameView(widget->CreateNonClientFrameView());
69 widget->ThemeChanged(); 69 widget->ThemeChanged();
70 Layout(); 70 Layout();
71 SchedulePaint(); 71 SchedulePaint();
72 widget->UpdateFrameAfterFrameChange(); 72 widget->UpdateFrameAfterFrameChange();
73 } 73 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 return View::GetEventHandlerForPoint(point); 184 return View::GetEventHandlerForPoint(point);
185 } 185 }
186 186
187 //////////////////////////////////////////////////////////////////////////////// 187 ////////////////////////////////////////////////////////////////////////////////
188 // NonClientFrameView, View overrides: 188 // NonClientFrameView, View overrides:
189 189
190 bool NonClientFrameView::HitTest(const gfx::Point& l) const { 190 bool NonClientFrameView::HitTest(const gfx::Point& l) const {
191 // For the default case, we assume the non-client frame view never overlaps 191 // For the default case, we assume the non-client frame view never overlaps
192 // the client view. 192 // the client view.
193 return !GetWindow()->client_view()->bounds().Contains(l); 193 return !GetWidget()->client_view()->bounds().Contains(l);
194 } 194 }
195 195
196 //////////////////////////////////////////////////////////////////////////////// 196 ////////////////////////////////////////////////////////////////////////////////
197 // NonClientFrameView, protected: 197 // NonClientFrameView, protected:
198 198
199 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, 199 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point,
200 int top_resize_border_height, 200 int top_resize_border_height,
201 int resize_border_thickness, 201 int resize_border_thickness,
202 int top_resize_corner_height, 202 int top_resize_corner_height,
203 int resize_corner_width, 203 int resize_corner_width,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } else { 239 } else {
240 return HTNOWHERE; 240 return HTNOWHERE;
241 } 241 }
242 242
243 // If the window can't be resized, there are no resize boundaries, just 243 // If the window can't be resized, there are no resize boundaries, just
244 // window borders. 244 // window borders.
245 return can_resize ? component : HTBORDER; 245 return can_resize ? component : HTBORDER;
246 } 246 }
247 247
248 bool NonClientFrameView::ShouldPaintAsActive() const { 248 bool NonClientFrameView::ShouldPaintAsActive() const {
249 return GetWindow()->IsActive() || paint_as_active_; 249 return GetWidget()->IsActive() || paint_as_active_;
250 } 250 }
251 251
252 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { 252 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) {
253 state->role = ui::AccessibilityTypes::ROLE_WINDOW; 253 state->role = ui::AccessibilityTypes::ROLE_WINDOW;
254 } 254 }
255 255
256 std::string NonClientFrameView::GetClassName() const { 256 std::string NonClientFrameView::GetClassName() const {
257 return kViewClassName; 257 return kViewClassName;
258 } 258 }
259 259
260 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 260 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
261 // Overridden to do nothing. The NonClientView manually calls Layout on the 261 // Overridden to do nothing. The NonClientView manually calls Layout on the
262 // FrameView when it is itself laid out, see comment in NonClientView::Layout. 262 // FrameView when it is itself laid out, see comment in NonClientView::Layout.
263 } 263 }
264 264
265 } // namespace views 265 } // namespace views
OLDNEW
« no previous file with comments | « views/window/native_window_win.cc ('k') | views/window/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698