| OLD | NEW |
| 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" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 node_data->SetName(shelf_view_->GetTitleForView(this)); | 238 node_data->SetName(shelf_view_->GetTitleForView(this)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 std::unique_ptr<views::InkDropRipple> AppListButton::CreateInkDropRipple() | 241 std::unique_ptr<views::InkDropRipple> AppListButton::CreateInkDropRipple() |
| 242 const { | 242 const { |
| 243 gfx::Point center = GetCenterPoint(); | 243 gfx::Point center = GetCenterPoint(); |
| 244 gfx::Rect bounds(center.x() - kAppListButtonRadius, | 244 gfx::Rect bounds(center.x() - kAppListButtonRadius, |
| 245 center.y() - kAppListButtonRadius, 2 * kAppListButtonRadius, | 245 center.y() - kAppListButtonRadius, 2 * kAppListButtonRadius, |
| 246 2 * kAppListButtonRadius); | 246 2 * kAppListButtonRadius); |
| 247 return base::MakeUnique<views::FloodFillInkDropRipple>( | 247 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 248 bounds, GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), | 248 size(), GetLocalBounds().InsetsFrom(bounds), |
| 249 GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), |
| 249 ink_drop_visible_opacity()); | 250 ink_drop_visible_opacity()); |
| 250 } | 251 } |
| 251 | 252 |
| 252 void AppListButton::NotifyClick(const ui::Event& event) { | 253 void AppListButton::NotifyClick(const ui::Event& event) { |
| 253 ImageButton::NotifyClick(event); | 254 ImageButton::NotifyClick(event); |
| 254 if (listener_) | 255 if (listener_) |
| 255 listener_->ButtonPressed(this, event, GetInkDrop()); | 256 listener_->ButtonPressed(this, event, GetInkDrop()); |
| 256 } | 257 } |
| 257 | 258 |
| 258 bool AppListButton::ShouldEnterPushedState(const ui::Event& event) { | 259 bool AppListButton::ShouldEnterPushedState(const ui::Event& event) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 289 int center = std::max(width(), height()) / 2.f; | 290 int center = std::max(width(), height()) / 2.f; |
| 290 gfx::Point centroid(center, center); | 291 gfx::Point centroid(center, center); |
| 291 // For the left shelf alignment, we need to right-justify. For other shelf | 292 // For the left shelf alignment, we need to right-justify. For other shelf |
| 292 // alignments, left/top justification (i.e. no adjustments are necessary). | 293 // alignments, left/top justification (i.e. no adjustments are necessary). |
| 293 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) | 294 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) |
| 294 centroid.set_x(width() - center); | 295 centroid.set_x(width() - center); |
| 295 return centroid; | 296 return centroid; |
| 296 } | 297 } |
| 297 | 298 |
| 298 } // namespace ash | 299 } // namespace ash |
| OLD | NEW |