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

Side by Side Diff: ash/shelf/app_list_button.cc

Issue 2033553003: Add MD ink drop ripple to shelf app items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (after r398375) Created 4 years, 6 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 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/shelf/app_list_button.h" 5 #include "ash/shelf/app_list_button.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/common/shelf/shelf_item_types.h" 8 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_view.h" 10 #include "ash/shelf/shelf_view.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "grit/ash_resources.h" 14 #include "grit/ash_resources.h"
15 #include "grit/ash_strings.h" 15 #include "grit/ash_strings.h"
16 #include "ui/accessibility/ax_view_state.h" 16 #include "ui/accessibility/ax_view_state.h"
17 #include "ui/app_list/app_list_switches.h" 17 #include "ui/app_list/app_list_switches.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/base/ui_base_switches_util.h" 20 #include "ui/base/ui_base_switches_util.h"
21 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
22 #include "ui/views/painter.h" 22 #include "ui/views/painter.h"
23 23
24 namespace ash { 24 namespace ash {
25 25
26 AppListButton::AppListButton(ShelfView* shelf_view) 26 AppListButton::AppListButton(ShelfView* shelf_view)
27 : views::ImageButton(shelf_view), 27 : views::ImageButton(nullptr),
28 draw_background_as_active_(false), 28 draw_background_as_active_(false),
29 shelf_view_(shelf_view) { 29 shelf_view_(shelf_view) {
30 SetAccessibleName( 30 SetAccessibleName(
31 app_list::switches::IsExperimentalAppListEnabled() 31 app_list::switches::IsExperimentalAppListEnabled()
32 ? l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE) 32 ? l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE)
33 : l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE)); 33 : l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE));
34 SetSize(gfx::Size(kShelfSize, kShelfSize)); 34 SetSize(gfx::Size(kShelfSize, kShelfSize));
35 SetFocusPainter(views::Painter::CreateSolidFocusPainter( 35 SetFocusPainter(views::Painter::CreateSolidFocusPainter(
36 kFocusBorderColor, gfx::Insets(1, 1, 1, 1))); 36 kFocusBorderColor, gfx::Insets(1, 1, 1, 1)));
37 set_notify_action(CustomButton::NOTIFY_ON_PRESS); 37 set_notify_action(CustomButton::NOTIFY_ON_PRESS);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 forground_bounds.y()); 156 forground_bounds.y());
157 157
158 views::Painter::PaintFocusPainter(this, canvas, focus_painter()); 158 views::Painter::PaintFocusPainter(this, canvas, focus_painter());
159 } 159 }
160 160
161 void AppListButton::GetAccessibleState(ui::AXViewState* state) { 161 void AppListButton::GetAccessibleState(ui::AXViewState* state) {
162 state->role = ui::AX_ROLE_BUTTON; 162 state->role = ui::AX_ROLE_BUTTON;
163 state->name = shelf_view_->GetTitleForView(this); 163 state->name = shelf_view_->GetTitleForView(this);
164 } 164 }
165 165
166 void AppListButton::NotifyClick(const ui::Event& event) {
167 ImageButton::NotifyClick(event);
168 shelf_view_->ButtonPressed(this, event, ink_drop());
169 }
170
166 void AppListButton::SetDrawBackgroundAsActive( 171 void AppListButton::SetDrawBackgroundAsActive(
167 bool draw_background_as_active) { 172 bool draw_background_as_active) {
168 if (draw_background_as_active_ == draw_background_as_active) 173 if (draw_background_as_active_ == draw_background_as_active)
169 return; 174 return;
170 draw_background_as_active_ = draw_background_as_active; 175 draw_background_as_active_ = draw_background_as_active;
171 SchedulePaint(); 176 SchedulePaint();
172 } 177 }
173 178
174 } // namespace ash 179 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698