Chromium Code Reviews| 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 #include "ui/views/controls/button/text_button.h" | 5 #include "ui/views/controls/button/text_button.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" | 
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 } | 462 } | 
| 463 | 463 | 
| 464 return flags; | 464 return flags; | 
| 465 } | 465 } | 
| 466 | 466 | 
| 467 void TextButtonBase::GetExtraParams( | 467 void TextButtonBase::GetExtraParams( | 
| 468 ui::NativeTheme::ExtraParams* params) const { | 468 ui::NativeTheme::ExtraParams* params) const { | 
| 469 params->button.checked = false; | 469 params->button.checked = false; | 
| 470 params->button.indeterminate = false; | 470 params->button.indeterminate = false; | 
| 471 params->button.is_default = false; | 471 params->button.is_default = false; | 
| 472 params->button.is_focused = false; | |
| 472 params->button.has_border = false; | 473 params->button.has_border = false; | 
| 473 params->button.classic_state = 0; | 474 params->button.classic_state = 0; | 
| 474 params->button.background_color = | 475 params->button.background_color = | 
| 475 ui::NativeTheme::instance()->GetSystemColor( | 476 ui::NativeTheme::instance()->GetSystemColor( | 
| 476 ui::NativeTheme::kColorId_TextButtonBackgroundColor); | 477 ui::NativeTheme::kColorId_TextButtonBackgroundColor); | 
| 477 } | 478 } | 
| 478 | 479 | 
| 479 gfx::Rect TextButtonBase::GetContentBounds(int extra_width) const { | 480 gfx::Rect TextButtonBase::GetContentBounds(int extra_width) const { | 
| 480 gfx::Insets insets = GetInsets(); | 481 gfx::Insets insets = GetInsets(); | 
| 481 int available_width = width() - insets.width(); | 482 int available_width = width() - insets.width(); | 
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 } | 844 } | 
| 844 | 845 | 
| 845 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | 846 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | 
| 846 #if defined(OS_WIN) | 847 #if defined(OS_WIN) | 
| 847 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 848 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 
| 848 gfx::Rect rect(GetLocalBounds()); | 849 gfx::Rect rect(GetLocalBounds()); | 
| 849 rect.Inset(kFocusRectInset, kFocusRectInset); | 850 rect.Inset(kFocusRectInset, kFocusRectInset); | 
| 850 canvas->DrawFocusRect(rect); | 851 canvas->DrawFocusRect(rect); | 
| 851 } | 852 } | 
| 852 #else | 853 #else | 
| 853 TextButton::OnPaintFocusBorder(canvas); | 854 // Paint nothing, focus will be indicated with a border highlight drawn by | 
| 855 // NativeThemeBase::PaintButton. | |
| 854 #endif | 856 #endif | 
| 855 } | 857 } | 
| 856 | 858 | 
| 857 void NativeTextButton::GetExtraParams( | 859 void NativeTextButton::GetExtraParams( | 
| 858 ui::NativeTheme::ExtraParams* params) const { | 860 ui::NativeTheme::ExtraParams* params) const { | 
| 859 TextButton::GetExtraParams(params); | 861 TextButton::GetExtraParams(params); | 
| 860 params->button.has_border = true; | 862 params->button.has_border = true; | 
| 863 #if !defined(OS_WIN) | |
| 864 params->button.is_focused = HasFocus() && | |
| 
 
sky
2012/06/05 20:25:36
Add a comment as to why this is ifdef'd.
 
 | |
| 865 (focusable() || IsAccessibilityFocusable()); | |
| 866 #endif | |
| 861 } | 867 } | 
| 862 | 868 | 
| 863 } // namespace views | 869 } // namespace views | 
| OLD | NEW |