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

Side by Side Diff: ui/views/controls/button/checkbox.cc

Issue 8964001: views: Convert IsFocusable() to just focusable() since it's just a simple accessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't need to override IsFocusableInRootView in omnibox_view_views Created 9 years 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) 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 "ui/views/controls/button/checkbox.h" 5 #include "ui/views/controls/button/checkbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/accessibility/accessible_view_state.h" 8 #include "ui/base/accessibility/accessible_view_state.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/controls/label.h" 10 #include "ui/views/controls/label.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return kViewClassName; 54 return kViewClassName;
55 } 55 }
56 56
57 void Checkbox::GetAccessibleState(ui::AccessibleViewState* state) { 57 void Checkbox::GetAccessibleState(ui::AccessibleViewState* state) {
58 TextButtonBase::GetAccessibleState(state); 58 TextButtonBase::GetAccessibleState(state);
59 state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON; 59 state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON;
60 state->state = checked() ? ui::AccessibilityTypes::STATE_CHECKED : 0; 60 state->state = checked() ? ui::AccessibilityTypes::STATE_CHECKED : 0;
61 } 61 }
62 62
63 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) { 63 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) {
64 if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView())) { 64 if (HasFocus() && (focusable() || IsAccessibilityFocusableInRootView())) {
65 gfx::Rect bounds(GetTextBounds()); 65 gfx::Rect bounds(GetTextBounds());
66 // Increate the bounding box by one on each side so that that focus border 66 // Increate the bounding box by one on each side so that that focus border
67 // does not draw on top of the letters. 67 // does not draw on top of the letters.
68 bounds.Inset(-1, -1, -1, -1); 68 bounds.Inset(-1, -1, -1, -1);
69 canvas->DrawFocusRect(bounds); 69 canvas->DrawFocusRect(bounds);
70 } 70 }
71 } 71 }
72 72
73 void Checkbox::NotifyClick(const views::Event& event) { 73 void Checkbox::NotifyClick(const views::Event& event) {
74 SetChecked(!checked()); 74 SetChecked(!checked());
(...skipping 28 matching lines...) Expand all
103 gfx::NativeTheme::ExtraParams extra; 103 gfx::NativeTheme::ExtraParams extra;
104 gfx::NativeTheme::State state = GetThemeState(&extra); 104 gfx::NativeTheme::State state = GetThemeState(&extra);
105 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), 105 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(),
106 state, 106 state,
107 extra)); 107 extra));
108 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); 108 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0);
109 return bounds; 109 return bounds;
110 } 110 }
111 111
112 } // namespace views 112 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698