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

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2694903010: AX checked state changes (Closed)
Patch Set: Fix compiler error Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/system/chromeos/ime_menu/ime_list_view.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/ime_info.h" 9 #include "ash/common/system/tray/ime_info.h"
10 #include "ash/common/system/tray/system_menu_button.h" 10 #include "ash/common/system/tray/system_menu_button.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 AddLabel(label, gfx::ALIGN_LEFT, selected); 55 AddLabel(label, gfx::ALIGN_LEFT, selected);
56 } 56 }
57 57
58 ~SelectableHoverHighlightView() override {} 58 ~SelectableHoverHighlightView() override {}
59 59
60 protected: 60 protected:
61 // views::View: 61 // views::View:
62 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { 62 void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
63 HoverHighlightView::GetAccessibleNodeData(node_data); 63 HoverHighlightView::GetAccessibleNodeData(node_data);
64 node_data->role = ui::AX_ROLE_CHECK_BOX; 64 node_data->role = ui::AX_ROLE_CHECK_BOX;
65 if (selected_) 65 const ui::AXCheckedState checked_state =
66 node_data->AddStateFlag(ui::AX_STATE_CHECKED); 66 selected_ ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE;
67 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state);
67 } 68 }
68 69
69 private: 70 private:
70 bool selected_; 71 bool selected_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(SelectableHoverHighlightView); 73 DISALLOW_COPY_AND_ASSIGN(SelectableHoverHighlightView);
73 }; 74 };
74 75
75 // The IME list item view used in the material design. It contains IME info 76 // The IME list item view used in the material design. It contains IME info
76 // (name and label) and a check button if the item is selected. It's also used 77 // (name and label) and a check button if the item is selected. It's also used
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 void OnFocus() override { 152 void OnFocus() override {
152 ActionableView::OnFocus(); 153 ActionableView::OnFocus();
153 if (ime_list_view_ && ime_list_view_->scroll_content()) 154 if (ime_list_view_ && ime_list_view_->scroll_content())
154 ime_list_view_->scroll_content()->ScrollRectToVisible(bounds()); 155 ime_list_view_->scroll_content()->ScrollRectToVisible(bounds());
155 } 156 }
156 157
157 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { 158 void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
158 ActionableView::GetAccessibleNodeData(node_data); 159 ActionableView::GetAccessibleNodeData(node_data);
159 node_data->role = ui::AX_ROLE_CHECK_BOX; 160 node_data->role = ui::AX_ROLE_CHECK_BOX;
160 node_data->AddStateFlag(selected_ ? ui::AX_STATE_CHECKED 161 const ui::AXCheckedState checked_state =
161 : ui::AX_STATE_NONE); 162 selected_ ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE;
163 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state);
162 } 164 }
163 165
164 private: 166 private:
165 ImeListView* ime_list_view_; 167 ImeListView* ime_list_view_;
166 bool selected_; 168 bool selected_;
167 169
168 DISALLOW_COPY_AND_ASSIGN(ImeListItemView); 170 DISALLOW_COPY_AND_ASSIGN(ImeListItemView);
169 }; 171 };
170 172
171 } // namespace 173 } // namespace
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) 462 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view)
461 : ime_list_view_(ime_list_view) {} 463 : ime_list_view_(ime_list_view) {}
462 464
463 ImeListViewTestApi::~ImeListViewTestApi() {} 465 ImeListViewTestApi::~ImeListViewTestApi() {}
464 466
465 views::View* ImeListViewTestApi::GetToggleView() const { 467 views::View* ImeListViewTestApi::GetToggleView() const {
466 return ime_list_view_->material_keyboard_status_view_->toggle(); 468 return ime_list_view_->material_keyboard_status_view_->toggle();
467 } 469 }
468 470
469 } // namespace ash 471 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698