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

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

Issue 2533053002: Handle view resize for ripple (Closed)
Patch Set: const -> constexpr Created 4 years 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 | « no previous file | ash/common/shelf/overflow_button.cc » ('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"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/common/shelf/overflow_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698