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

Side by Side Diff: ash/common/shelf/shelf_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/shelf_button.h ('k') | ash/common/shelf/shelf_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf_button.h" 5 #include "ash/common/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
11 #include "ash/common/shelf/ink_drop_button_listener.h" 11 #include "ash/common/shelf/ink_drop_button_listener.h"
12 #include "ash/common/shelf/shelf_constants.h" 12 #include "ash/common/shelf/shelf_constants.h"
13 #include "ash/common/shelf/shelf_view.h" 13 #include "ash/common/shelf/shelf_view.h"
14 #include "ash/common/shelf/wm_shelf.h" 14 #include "ash/common/shelf/wm_shelf.h"
15 #include "ash/common/shelf/wm_shelf_util.h" 15 #include "ash/common/shelf/wm_shelf_util.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "grit/ash_resources.h" 17 #include "grit/ash_resources.h"
18 #include "skia/ext/image_operations.h" 18 #include "skia/ext/image_operations.h"
19 #include "third_party/skia/include/core/SkPaint.h" 19 #include "third_party/skia/include/core/SkPaint.h"
20 #include "ui/accessibility/ax_view_state.h" 20 #include "ui/accessibility/ax_node_data.h"
21 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/compositor/layer.h" 22 #include "ui/compositor/layer.h"
23 #include "ui/compositor/scoped_layer_animation_settings.h" 23 #include "ui/compositor/scoped_layer_animation_settings.h"
24 #include "ui/events/event_constants.h" 24 #include "ui/events/event_constants.h"
25 #include "ui/gfx/animation/animation_delegate.h" 25 #include "ui/gfx/animation/animation_delegate.h"
26 #include "ui/gfx/animation/throb_animation.h" 26 #include "ui/gfx/animation/throb_animation.h"
27 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/geometry/vector2d.h" 28 #include "ui/gfx/geometry/vector2d.h"
29 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/image/image_skia_operations.h" 30 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 shelf_view_->PointerReleasedOnButton(this, ShelfView::MOUSE, true); 388 shelf_view_->PointerReleasedOnButton(this, ShelfView::MOUSE, true);
389 CustomButton::OnMouseCaptureLost(); 389 CustomButton::OnMouseCaptureLost();
390 } 390 }
391 391
392 bool ShelfButton::OnMouseDragged(const ui::MouseEvent& event) { 392 bool ShelfButton::OnMouseDragged(const ui::MouseEvent& event) {
393 CustomButton::OnMouseDragged(event); 393 CustomButton::OnMouseDragged(event);
394 shelf_view_->PointerDraggedOnButton(this, ShelfView::MOUSE, event); 394 shelf_view_->PointerDraggedOnButton(this, ShelfView::MOUSE, event);
395 return true; 395 return true;
396 } 396 }
397 397
398 void ShelfButton::GetAccessibleState(ui::AXViewState* state) { 398 void ShelfButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
399 state->role = ui::AX_ROLE_BUTTON; 399 node_data->role = ui::AX_ROLE_BUTTON;
400 state->name = shelf_view_->GetTitleForView(this); 400 node_data->SetName(shelf_view_->GetTitleForView(this));
401 } 401 }
402 402
403 void ShelfButton::Layout() { 403 void ShelfButton::Layout() {
404 const gfx::Rect button_bounds(GetContentsBounds()); 404 const gfx::Rect button_bounds(GetContentsBounds());
405 WmShelf* wm_shelf = shelf_view_->wm_shelf(); 405 WmShelf* wm_shelf = shelf_view_->wm_shelf();
406 const bool is_horizontal_shelf = 406 const bool is_horizontal_shelf =
407 IsHorizontalAlignment(wm_shelf->GetAlignment()); 407 IsHorizontalAlignment(wm_shelf->GetAlignment());
408 const int icon_pad = ash::MaterialDesignController::IsShelfMaterial() 408 const int icon_pad = ash::MaterialDesignController::IsShelfMaterial()
409 ? (is_horizontal_shelf ? kIconPaddingHorizontalMD 409 ? (is_horizontal_shelf ? kIconPaddingHorizontalMD
410 : kIconPaddingVerticalMD) 410 : kIconPaddingVerticalMD)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); 594 bar_->SetHorizontalAlignment(views::ImageView::TRAILING);
595 bar_->SetVerticalAlignment(views::ImageView::CENTER); 595 bar_->SetVerticalAlignment(views::ImageView::CENTER);
596 break; 596 break;
597 } 597 }
598 bar_->SchedulePaint(); 598 bar_->SchedulePaint();
599 } 599 }
600 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 600 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
601 } 601 }
602 602
603 } // namespace ash 603 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_button.h ('k') | ash/common/shelf/shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698