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

Side by Side Diff: ash/common/shelf/app_list_button.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/shelf/app_list_button.h ('k') | ash/common/shelf/shelf_button.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shelf/app_list_button.h" 5 #include "ash/common/shelf/app_list_button.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/shelf/ink_drop_button_listener.h" 9 #include "ash/common/shelf/ink_drop_button_listener.h"
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
11 #include "ash/common/shelf/shelf_item_types.h" 11 #include "ash/common/shelf/shelf_item_types.h"
12 #include "ash/common/shelf/shelf_view.h" 12 #include "ash/common/shelf/shelf_view.h"
13 #include "ash/common/shelf/wm_shelf.h" 13 #include "ash/common/shelf/wm_shelf.h"
14 #include "ash/common/shelf/wm_shelf_util.h" 14 #include "ash/common/shelf/wm_shelf_util.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/public/cpp/shelf_types.h" 16 #include "ash/public/cpp/shelf_types.h"
17 #include "ash/resources/vector_icons/vector_icons.h" 17 #include "ash/resources/vector_icons/vector_icons.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
20 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
21 #include "ui/accessibility/ax_view_state.h" 21 #include "ui/accessibility/ax_node_data.h"
22 #include "ui/app_list/app_list_switches.h" 22 #include "ui/app_list/app_list_switches.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
26 #include "ui/gfx/paint_vector_icon.h" 26 #include "ui/gfx/paint_vector_icon.h"
27 #include "ui/views/animation/square_ink_drop_ripple.h" 27 #include "ui/views/animation/square_ink_drop_ripple.h"
28 #include "ui/views/painter.h" 28 #include "ui/views/painter.h"
29 29
30 namespace ash { 30 namespace ash {
31 31
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 background_bounds.x() + 236 background_bounds.x() +
237 std::max(0, (background_bounds.width() - foreground_bounds.width()) / 2)); 237 std::max(0, (background_bounds.width() - foreground_bounds.width()) / 2));
238 foreground_bounds.set_y( 238 foreground_bounds.set_y(
239 background_bounds.y() + 239 background_bounds.y() +
240 std::max(0, 240 std::max(0,
241 (background_bounds.height() - foreground_bounds.height()) / 2)); 241 (background_bounds.height() - foreground_bounds.height()) / 2));
242 canvas->DrawImageInt(foreground_image, foreground_bounds.x(), 242 canvas->DrawImageInt(foreground_image, foreground_bounds.x(),
243 foreground_bounds.y()); 243 foreground_bounds.y());
244 } 244 }
245 245
246 void AppListButton::GetAccessibleState(ui::AXViewState* state) { 246 void AppListButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
247 state->role = ui::AX_ROLE_BUTTON; 247 node_data->role = ui::AX_ROLE_BUTTON;
248 state->name = shelf_view_->GetTitleForView(this); 248 node_data->SetName(shelf_view_->GetTitleForView(this));
249 } 249 }
250 250
251 std::unique_ptr<views::InkDropRipple> AppListButton::CreateInkDropRipple() 251 std::unique_ptr<views::InkDropRipple> AppListButton::CreateInkDropRipple()
252 const { 252 const {
253 // TODO(mohsen): A circular SquareInkDropRipple is created with equal small 253 // TODO(mohsen): A circular SquareInkDropRipple is created with equal small
254 // and large sizes to mimic a circular flood fill. Replace with an actual 254 // and large sizes to mimic a circular flood fill. Replace with an actual
255 // flood fill when circular flood fills are implemented. 255 // flood fill when circular flood fills are implemented.
256 gfx::Size ripple_size(2 * kAppListButtonRadius, 2 * kAppListButtonRadius); 256 gfx::Size ripple_size(2 * kAppListButtonRadius, 2 * kAppListButtonRadius);
257 auto* ink_drop_ripple = new views::SquareInkDropRipple( 257 auto* ink_drop_ripple = new views::SquareInkDropRipple(
258 ripple_size, 0, ripple_size, 0, GetContentsBounds().CenterPoint(), 258 ripple_size, 0, ripple_size, 0, GetContentsBounds().CenterPoint(),
(...skipping 21 matching lines...) Expand all
280 } 280 }
281 281
282 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) { 282 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) {
283 if (draw_background_as_active_ == draw_background_as_active) 283 if (draw_background_as_active_ == draw_background_as_active)
284 return; 284 return;
285 draw_background_as_active_ = draw_background_as_active; 285 draw_background_as_active_ = draw_background_as_active;
286 SchedulePaint(); 286 SchedulePaint();
287 } 287 }
288 288
289 } // namespace ash 289 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/app_list_button.h ('k') | ash/common/shelf/shelf_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698