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

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

Issue 10919076: app_list: Paint background for app item title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/search_result_view.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 (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/app_list_item_view.h" 5 #include "ui/app_list/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/synchronization/cancellation_flag.h" 11 #include "base/synchronization/cancellation_flag.h"
12 #include "base/threading/worker_pool.h" 12 #include "base/threading/worker_pool.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "ui/app_list/app_list_constants.h"
14 #include "ui/app_list/app_list_item_model.h" 15 #include "ui/app_list/app_list_item_model.h"
15 #include "ui/app_list/apps_grid_view.h" 16 #include "ui/app_list/apps_grid_view.h"
16 #include "ui/app_list/drop_shadow_label.h" 17 #include "ui/app_list/drop_shadow_label.h"
17 #include "ui/app_list/icon_cache.h" 18 #include "ui/app_list/icon_cache.h"
18 #include "ui/base/accessibility/accessible_view_state.h" 19 #include "ui/base/accessibility/accessible_view_state.h"
19 #include "ui/base/animation/throb_animation.h" 20 #include "ui/base/animation/throb_animation.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/font.h" 23 #include "ui/gfx/font.h"
23 #include "ui/gfx/image/image_skia_operations.h" 24 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 y + icon_size_.height() + kIconTitleSpacing, 254 y + icon_size_.height() + kIconTitleSpacing,
254 rect.width(), 255 rect.width(),
255 title_size.height()); 256 title_size.height());
256 } 257 }
257 258
258 void AppListItemView::OnPaint(gfx::Canvas* canvas) { 259 void AppListItemView::OnPaint(gfx::Canvas* canvas) {
259 gfx::Rect rect(GetContentsBounds()); 260 gfx::Rect rect(GetContentsBounds());
260 261
261 bool selected = apps_grid_view_->IsSelectedItem(this); 262 bool selected = apps_grid_view_->IsSelectedItem(this);
262 263
264 canvas->FillRect(rect, kContentsBackgroundColor);
263 if (model_->highlighted()) { 265 if (model_->highlighted()) {
264 canvas->FillRect(rect, kHighlightedColor); 266 canvas->FillRect(rect, kHighlightedColor);
265 } else if (hover_animation_->is_animating()) { 267 } else if (hover_animation_->is_animating()) {
266 int alpha = SkColorGetA(kHoverAndPushedColor) * 268 int alpha = SkColorGetA(kHoverAndPushedColor) *
267 hover_animation_->GetCurrentValue(); 269 hover_animation_->GetCurrentValue();
268 canvas->FillRect(rect, SkColorSetA(kHoverAndPushedColor, alpha)); 270 canvas->FillRect(rect, SkColorSetA(kHoverAndPushedColor, alpha));
269 } else if (state() == BS_HOT || state() == BS_PUSHED) { 271 } else if (state() == BS_HOT || state() == BS_PUSHED) {
270 canvas->FillRect(rect, kHoverAndPushedColor); 272 canvas->FillRect(rect, kHoverAndPushedColor);
271 } else if (selected) { 273 } else if (selected) {
272 canvas->FillRect(rect, kSelectedColor); 274 canvas->FillRect(rect, kSelectedColor);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool AppListItemView::ShouldEnterPushedState(const ui::Event& event) { 311 bool AppListItemView::ShouldEnterPushedState(const ui::Event& event) {
310 // Don't enter pushed state for ET_GESTURE_TAP_DOWN so that hover gray 312 // Don't enter pushed state for ET_GESTURE_TAP_DOWN so that hover gray
311 // background does not show up during scroll. 313 // background does not show up during scroll.
312 if (event.type() == ui::ET_GESTURE_TAP_DOWN) 314 if (event.type() == ui::ET_GESTURE_TAP_DOWN)
313 return false; 315 return false;
314 316
315 return views::CustomButton::ShouldEnterPushedState(event); 317 return views::CustomButton::ShouldEnterPushedState(event);
316 } 318 }
317 319
318 } // namespace app_list 320 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/search_result_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698