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

Side by Side Diff: ui/views/controls/scrollbar/native_scroll_bar_views.cc

Issue 12212144: Add NULL check for NativeTheme in scrollbar methods. A NULL theme can (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « no previous file | no next file » | 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) 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/controls/scrollbar/native_scroll_bar_views.h" 5 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/keycodes/keyboard_codes.h" 8 #include "ui/base/keycodes/keyboard_codes.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/path.h" 10 #include "ui/gfx/path.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 // static 376 // static
377 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( 377 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper(
378 NativeScrollBar* scroll_bar) { 378 NativeScrollBar* scroll_bar) {
379 return new NativeScrollBarViews(scroll_bar); 379 return new NativeScrollBarViews(scroll_bar);
380 } 380 }
381 381
382 // static 382 // static
383 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight( 383 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight(
384 const ui::NativeTheme* theme) { 384 const ui::NativeTheme* theme) {
385 if (!theme)
386 theme = ui::NativeTheme::instance();
385 ui::NativeTheme::ExtraParams button_params; 387 ui::NativeTheme::ExtraParams button_params;
386 button_params.scrollbar_arrow.is_hovering = false; 388 button_params.scrollbar_arrow.is_hovering = false;
387 gfx::Size button_size = theme->GetPartSize( 389 gfx::Size button_size = theme->GetPartSize(
388 ui::NativeTheme::kScrollbarLeftArrow, 390 ui::NativeTheme::kScrollbarLeftArrow,
389 ui::NativeTheme::kNormal, 391 ui::NativeTheme::kNormal,
390 button_params); 392 button_params);
391 393
392 ui::NativeTheme::ExtraParams thumb_params; 394 ui::NativeTheme::ExtraParams thumb_params;
393 thumb_params.scrollbar_thumb.is_hovering = false; 395 thumb_params.scrollbar_thumb.is_hovering = false;
394 gfx::Size track_size = theme->GetPartSize( 396 gfx::Size track_size = theme->GetPartSize(
395 ui::NativeTheme::kScrollbarHorizontalThumb, 397 ui::NativeTheme::kScrollbarHorizontalThumb,
396 ui::NativeTheme::kNormal, 398 ui::NativeTheme::kNormal,
397 thumb_params); 399 thumb_params);
398 400
399 return std::max(track_size.height(), button_size.height()); 401 return std::max(track_size.height(), button_size.height());
400 } 402 }
401 403
402 // static 404 // static
403 int NativeScrollBarWrapper::GetVerticalScrollBarWidth( 405 int NativeScrollBarWrapper::GetVerticalScrollBarWidth(
404 const ui::NativeTheme* theme) { 406 const ui::NativeTheme* theme) {
407 if (!theme)
408 theme = ui::NativeTheme::instance();
405 ui::NativeTheme::ExtraParams button_params; 409 ui::NativeTheme::ExtraParams button_params;
406 button_params.scrollbar_arrow.is_hovering = false; 410 button_params.scrollbar_arrow.is_hovering = false;
407 gfx::Size button_size = theme->GetPartSize( 411 gfx::Size button_size = theme->GetPartSize(
408 ui::NativeTheme::kScrollbarUpArrow, 412 ui::NativeTheme::kScrollbarUpArrow,
409 ui::NativeTheme::kNormal, 413 ui::NativeTheme::kNormal,
410 button_params); 414 button_params);
411 415
412 ui::NativeTheme::ExtraParams thumb_params; 416 ui::NativeTheme::ExtraParams thumb_params;
413 thumb_params.scrollbar_thumb.is_hovering = false; 417 thumb_params.scrollbar_thumb.is_hovering = false;
414 gfx::Size track_size = theme->GetPartSize( 418 gfx::Size track_size = theme->GetPartSize(
415 ui::NativeTheme::kScrollbarVerticalThumb, 419 ui::NativeTheme::kScrollbarVerticalThumb,
416 ui::NativeTheme::kNormal, 420 ui::NativeTheme::kNormal,
417 thumb_params); 421 thumb_params);
418 422
419 return std::max(track_size.width(), button_size.width()); 423 return std::max(track_size.width(), button_size.width());
420 } 424 }
421 425
422 } // namespace views 426 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698