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

Side by Side Diff: ash/common/system/chromeos/tray_caps_lock.cc

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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
« no previous file with comments | « ash/common/system/chromeos/power/tray_power.cc ('k') | ash/common/system/date/date_view.h » ('j') | 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 "ash/common/system/chromeos/tray_caps_lock.h" 5 #include "ash/common/system/chromeos/tray_caps_lock.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/actionable_view.h" 8 #include "ash/common/system/tray/actionable_view.h"
9 #include "ash/common/system/tray/fixed_sized_image_view.h" 9 #include "ash/common/system/tray/fixed_sized_image_view.h"
10 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
11 #include "ash/common/system/tray/tray_constants.h" 11 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/tray_popup_utils.h" 12 #include "ash/common/system/tray/tray_popup_utils.h"
13 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
14 #include "ash/resources/vector_icons/vector_icons.h" 14 #include "ash/resources/vector_icons/vector_icons.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
17 #include "grit/ash_strings.h" 17 #include "grit/ash_strings.h"
18 #include "ui/accessibility/ax_view_state.h" 18 #include "ui/accessibility/ax_node_data.h"
19 #include "ui/base/ime/chromeos/ime_keyboard.h" 19 #include "ui/base/ime/chromeos/ime_keyboard.h"
20 #include "ui/base/ime/chromeos/input_method_manager.h" 20 #include "ui/base/ime/chromeos/input_method_manager.h"
21 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/paint_vector_icon.h" 23 #include "ui/gfx/paint_vector_icon.h"
24 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
25 #include "ui/views/controls/label.h" 25 #include "ui/views/controls/label.h"
26 #include "ui/views/layout/box_layout.h" 26 #include "ui/views/layout/box_layout.h"
27 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
28 28
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Align the shortcut text with the right end 107 // Align the shortcut text with the right end
108 const int old_x = shortcut_label_->x(); 108 const int old_x = shortcut_label_->x();
109 const int new_x = 109 const int new_x =
110 width() - shortcut_label_->width() - kTrayPopupPaddingHorizontal; 110 width() - shortcut_label_->width() - kTrayPopupPaddingHorizontal;
111 shortcut_label_->SetX(new_x); 111 shortcut_label_->SetX(new_x);
112 const gfx::Size text_size = text_label_->size(); 112 const gfx::Size text_size = text_label_->size();
113 text_label_->SetSize( 113 text_label_->SetSize(
114 gfx::Size(text_size.width() + new_x - old_x, text_size.height())); 114 gfx::Size(text_size.width() + new_x - old_x, text_size.height()));
115 } 115 }
116 116
117 void GetAccessibleState(ui::AXViewState* state) override { 117 void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
118 state->role = ui::AX_ROLE_BUTTON; 118 node_data->role = ui::AX_ROLE_BUTTON;
119 state->name = text_label_->text(); 119 node_data->SetName(text_label_->text());
120 } 120 }
121 121
122 // Overridden from ActionableView: 122 // Overridden from ActionableView:
123 bool PerformAction(const ui::Event& event) override { 123 bool PerformAction(const ui::Event& event) override {
124 chromeos::input_method::ImeKeyboard* keyboard = 124 chromeos::input_method::ImeKeyboard* keyboard =
125 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 125 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
126 if (keyboard) { 126 if (keyboard) {
127 WmShell::Get()->RecordUserMetricsAction( 127 WmShell::Get()->RecordUserMetricsAction(
128 keyboard->CapsLockIsEnabled() 128 keyboard->CapsLockIsEnabled()
129 ? UMA_STATUS_AREA_CAPS_LOCK_DISABLED_BY_CLICK 129 ? UMA_STATUS_AREA_CAPS_LOCK_DISABLED_BY_CLICK
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 void TrayCapsLock::DestroyDefaultView() { 230 void TrayCapsLock::DestroyDefaultView() {
231 default_ = NULL; 231 default_ = NULL;
232 } 232 }
233 233
234 void TrayCapsLock::DestroyDetailedView() { 234 void TrayCapsLock::DestroyDetailedView() {
235 detailed_ = NULL; 235 detailed_ = NULL;
236 } 236 }
237 237
238 } // namespace ash 238 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/power/tray_power.cc ('k') | ash/common/system/date/date_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698