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

Side by Side Diff: ui/app_list/views/app_list_item_view.cc

Issue 2339523004: Remove old (dead) app list code. (Closed)
Patch Set: Address nonbistytftatl review. Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/app_list/views/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 (GetContentsBounds().width() - progress_bar_bounds.width()) / 2); 265 (GetContentsBounds().width() - progress_bar_bounds.width()) / 2);
266 progress_bar_bounds.set_y(title_bounds.y()); 266 progress_bar_bounds.set_y(title_bounds.y());
267 progress_bar_->SetBoundsRect(progress_bar_bounds); 267 progress_bar_->SetBoundsRect(progress_bar_bounds);
268 } 268 }
269 269
270 void AppListItemView::OnPaint(gfx::Canvas* canvas) { 270 void AppListItemView::OnPaint(gfx::Canvas* canvas) {
271 if (apps_grid_view_->IsDraggedView(this)) 271 if (apps_grid_view_->IsDraggedView(this))
272 return; 272 return;
273 273
274 gfx::Rect rect(GetContentsBounds()); 274 gfx::Rect rect(GetContentsBounds());
275 if (apps_grid_view_->IsSelectedView(this)) { 275 if (apps_grid_view_->IsSelectedView(this))
276 canvas->FillRect(rect, kSelectedColor); 276 canvas->FillRect(rect, kSelectedColor);
277 } else if (is_highlighted_ && !is_installing_ &&
278 !app_list::switches::IsExperimentalAppListEnabled()) {
279 canvas->FillRect(rect, kHighlightedColor);
280 return;
281 }
282 277
283 if (ui_state_ == UI_STATE_DROPPING_IN_FOLDER) { 278 if (ui_state_ == UI_STATE_DROPPING_IN_FOLDER) {
284 DCHECK(apps_grid_view_->model()->folders_enabled()); 279 DCHECK(apps_grid_view_->model()->folders_enabled());
285 280
286 // Draw folder dropping preview circle. 281 // Draw folder dropping preview circle.
287 gfx::Point center = gfx::Point(icon_->x() + icon_->size().width() / 2, 282 gfx::Point center = gfx::Point(icon_->x() + icon_->size().width() / 2,
288 icon_->y() + icon_->size().height() / 2); 283 icon_->y() + icon_->size().height() / 2);
289 SkPaint paint; 284 SkPaint paint;
290 paint.setStyle(SkPaint::kFill_Style); 285 paint.setStyle(SkPaint::kFill_Style);
291 paint.setAntiAlias(true); 286 paint.setAntiAlias(true);
(...skipping 13 matching lines...) Expand all
305 if (!apps_grid_view_->IsSelectedView(this)) 300 if (!apps_grid_view_->IsSelectedView(this))
306 apps_grid_view_->ClearAnySelectedView(); 301 apps_grid_view_->ClearAnySelectedView();
307 context_menu_runner_.reset(new views::MenuRunner( 302 context_menu_runner_.reset(new views::MenuRunner(
308 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); 303 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC));
309 context_menu_runner_->RunMenuAt(GetWidget(), NULL, 304 context_menu_runner_->RunMenuAt(GetWidget(), NULL,
310 gfx::Rect(point, gfx::Size()), 305 gfx::Rect(point, gfx::Size()),
311 views::MENU_ANCHOR_TOPLEFT, source_type); 306 views::MENU_ANCHOR_TOPLEFT, source_type);
312 } 307 }
313 308
314 void AppListItemView::StateChanged() { 309 void AppListItemView::StateChanged() {
315 if (app_list::switches::IsExperimentalAppListEnabled()) {
316 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
317 shadow_animator_.animation()->Show();
318 } else {
319 shadow_animator_.animation()->Hide();
320 }
321 }
322
323 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 310 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
311 shadow_animator_.animation()->Show();
324 // Show the hover/tap highlight: for tap, lighter highlight replaces darker 312 // Show the hover/tap highlight: for tap, lighter highlight replaces darker
325 // keyboard selection; for mouse hover, keyboard selection takes precedence. 313 // keyboard selection; for mouse hover, keyboard selection takes precedence.
326 if (!apps_grid_view_->IsSelectedView(this) || state() == STATE_PRESSED) 314 if (!apps_grid_view_->IsSelectedView(this) || state() == STATE_PRESSED)
327 SetItemIsHighlighted(true); 315 SetItemIsHighlighted(true);
328 } else { 316 } else {
317 shadow_animator_.animation()->Hide();
329 SetItemIsHighlighted(false); 318 SetItemIsHighlighted(false);
330 if (item_weak_) 319 if (item_weak_)
331 item_weak_->set_highlighted(false); 320 item_weak_->set_highlighted(false);
332 } 321 }
333 SetTitleSubpixelAA(); 322 SetTitleSubpixelAA();
334 } 323 }
335 324
336 bool AppListItemView::ShouldEnterPushedState(const ui::Event& event) { 325 bool AppListItemView::ShouldEnterPushedState(const ui::Event& event) {
337 // Don't enter pushed state for ET_GESTURE_TAP_DOWN so that hover gray 326 // Don't enter pushed state for ET_GESTURE_TAP_DOWN so that hover gray
338 // background does not show up during scroll. 327 // background does not show up during scroll.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 SetItemPercentDownloaded(item_weak_->percent_downloaded()); 515 SetItemPercentDownloaded(item_weak_->percent_downloaded());
527 } 516 }
528 517
529 void AppListItemView::ItemBeingDestroyed() { 518 void AppListItemView::ItemBeingDestroyed() {
530 DCHECK(item_weak_); 519 DCHECK(item_weak_);
531 item_weak_->RemoveObserver(this); 520 item_weak_->RemoveObserver(this);
532 item_weak_ = NULL; 521 item_weak_ = NULL;
533 } 522 }
534 523
535 } // namespace app_list 524 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698