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

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

Issue 99553008: Fix regression where the active window header was not used for apps on CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
OLDNEW
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 #include "ui/views/window/non_client_view.h" 5 #include "ui/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 "ui/base/hit_test.h" 8 #include "ui/base/hit_test.h"
9 #include "ui/gfx/rect_conversions.h" 9 #include "ui/gfx/rect_conversions.h"
10 #include "ui/views/rect_based_targeting_utils.h" 10 #include "ui/views/rect_based_targeting_utils.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (handler) 225 if (handler)
226 return handler; 226 return handler;
227 } 227 }
228 228
229 return View::GetTooltipHandlerForPoint(point); 229 return View::GetTooltipHandlerForPoint(point);
230 } 230 }
231 231
232 //////////////////////////////////////////////////////////////////////////////// 232 ////////////////////////////////////////////////////////////////////////////////
233 // NonClientFrameView, public: 233 // NonClientFrameView, public:
234 234
235 NonClientFrameView::~NonClientFrameView() {
236 }
237
235 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { 238 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) {
236 if (paint_as_active_ == disable) 239 if (inactive_rendering_disabled_ == disable)
237 return; 240 return;
238 241
239 paint_as_active_ = disable; 242 inactive_rendering_disabled_ = disable;
240 ShouldPaintAsActiveChanged(); 243 SchedulePaint();
sky 2014/01/06 19:13:49 Is this only necessary if !active?
244 }
245
246 bool NonClientFrameView::ShouldPaintAsActive() const {
247 return GetWidget()->IsActive() || inactive_rendering_disabled_;
sadrul 2014/01/03 17:59:51 We trigger SchedulePaint() when |inactive_renderin
pkotwicz 2014/01/03 20:57:16 Yes, NativeWidgetAura::OnWindowActivated() does th
sky 2014/01/06 19:13:49 nit: check inactive_rendering_disabled_ first (it'
241 } 248 }
242 249
243 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, 250 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point,
244 int top_resize_border_height, 251 int top_resize_border_height,
245 int resize_border_thickness, 252 int resize_border_thickness,
246 int top_resize_corner_height, 253 int top_resize_corner_height,
247 int resize_corner_width, 254 int resize_corner_width,
248 bool can_resize) { 255 bool can_resize) {
249 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for 256 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for
250 // a |resize_corner_size|-length strip of both the side and top borders, but 257 // a |resize_corner_size|-length strip of both the side and top borders, but
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 301
295 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const { 302 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const {
296 // For the default case, we assume the non-client frame view never overlaps 303 // For the default case, we assume the non-client frame view never overlaps
297 // the client view. 304 // the client view.
298 return !GetWidget()->client_view()->bounds().Intersects(rect); 305 return !GetWidget()->client_view()->bounds().Intersects(rect);
299 } 306 }
300 307
301 //////////////////////////////////////////////////////////////////////////////// 308 ////////////////////////////////////////////////////////////////////////////////
302 // NonClientFrameView, protected: 309 // NonClientFrameView, protected:
303 310
304 bool NonClientFrameView::ShouldPaintAsActive() const {
305 return GetWidget()->IsActive() || paint_as_active_;
306 }
307
308 void NonClientFrameView::ShouldPaintAsActiveChanged() {
309 SchedulePaint();
310 }
311
312 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { 311 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) {
313 state->role = ui::AccessibilityTypes::ROLE_CLIENT; 312 state->role = ui::AccessibilityTypes::ROLE_CLIENT;
314 } 313 }
315 314
316 const char* NonClientFrameView::GetClassName() const { 315 const char* NonClientFrameView::GetClassName() const {
317 return kViewClassName; 316 return kViewClassName;
318 } 317 }
319 318
320 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 319 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
321 // Overridden to do nothing. The NonClientView manually calls Layout on the 320 // Overridden to do nothing. The NonClientView manually calls Layout on the
322 // FrameView when it is itself laid out, see comment in NonClientView::Layout. 321 // FrameView when it is itself laid out, see comment in NonClientView::Layout.
323 } 322 }
324 323
324 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) {
325 }
326
325 } // namespace views 327 } // namespace views
OLDNEW
« ui/views/window/non_client_view.h ('K') | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698