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

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

Issue 10381018: ash: First pass of Applist v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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 | « ash/app_list/app_list_bubble_border.cc ('k') | ash/app_list/app_list_model_view.h » ('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 "ash/app_list/app_list_item_view.h" 5 #include "ash/app_list/app_list_item_view.h"
6 6
7 #include "ash/app_list/app_list.h"
7 #include "ash/app_list/app_list_item_model.h" 8 #include "ash/app_list/app_list_item_model.h"
8 #include "ash/app_list/app_list_model_view.h" 9 #include "ash/app_list/app_list_model_view.h"
9 #include "ash/app_list/drop_shadow_label.h" 10 #include "ash/app_list/drop_shadow_label.h"
10 #include "ash/app_list/icon_cache.h" 11 #include "ash/app_list/icon_cache.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/message_loop.h" 13 #include "base/message_loop.h"
13 #include "base/synchronization/cancellation_flag.h" 14 #include "base/synchronization/cancellation_flag.h"
14 #include "base/threading/worker_pool.h" 15 #include "base/threading/worker_pool.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "ui/base/accessibility/accessible_view_state.h" 17 #include "ui/base/accessibility/accessible_view_state.h"
17 #include "ui/base/animation/throb_animation.h" 18 #include "ui/base/animation/throb_animation.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/font.h" 21 #include "ui/gfx/font.h"
21 #include "ui/gfx/shadow_value.h" 22 #include "ui/gfx/shadow_value.h"
22 #include "ui/gfx/skbitmap_operations.h" 23 #include "ui/gfx/skbitmap_operations.h"
23 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
24 #include "ui/views/controls/menu/menu_item_view.h" 25 #include "ui/views/controls/menu/menu_item_view.h"
25 #include "ui/views/controls/menu/menu_model_adapter.h" 26 #include "ui/views/controls/menu/menu_model_adapter.h"
26 #include "ui/views/controls/menu/menu_runner.h" 27 #include "ui/views/controls/menu/menu_runner.h"
27 28
28 namespace ash { 29 namespace ash {
29 30
30 namespace { 31 namespace {
31 32
32 const int kTopBottomPadding = 10; 33 const int kTopBottomPadding = 10;
33 const int kIconTitleSpacing = 10; 34 const int kIconTitleSpacing = 10;
34 35
35 const SkColor kTitleColor = SK_ColorWHITE; 36 const SkColor kTitleColor = SK_ColorWHITE;
37 const SkColor kTitleColorV2 = SkColorSetARGB(0xFF, 0x88, 0x88, 0x88);
36 38
37 // 0.33 black 39 // 0.33 black
38 const SkColor kHoverAndPushedColor = SkColorSetARGB(0x55, 0x00, 0x00, 0x00); 40 const SkColor kHoverAndPushedColor = SkColorSetARGB(0x55, 0x00, 0x00, 0x00);
39 41
40 // 0.16 black 42 // 0.16 black
41 const SkColor kSelectedColor = SkColorSetARGB(0x2A, 0x00, 0x00, 0x00); 43 const SkColor kSelectedColor = SkColorSetARGB(0x2A, 0x00, 0x00, 0x00);
42 44
43 const SkColor kHighlightedColor = kHoverAndPushedColor; 45 const SkColor kHighlightedColor = kHoverAndPushedColor;
44 46
45 // FontSize/IconSize ratio = 24 / 128, which means we should get 24 font size 47 // FontSize/IconSize ratio = 24 / 128, which means we should get 24 font size
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 AppListItemModel* model, 180 AppListItemModel* model,
179 views::ButtonListener* listener) 181 views::ButtonListener* listener)
180 : CustomButton(listener), 182 : CustomButton(listener),
181 model_(model), 183 model_(model),
182 list_model_view_(list_model_view), 184 list_model_view_(list_model_view),
183 icon_(new StaticImageView), 185 icon_(new StaticImageView),
184 title_(new DropShadowLabel), 186 title_(new DropShadowLabel),
185 selected_(false), 187 selected_(false),
186 ALLOW_THIS_IN_INITIALIZER_LIST(apply_shadow_factory_(this)) { 188 ALLOW_THIS_IN_INITIALIZER_LIST(apply_shadow_factory_(this)) {
187 title_->SetBackgroundColor(0); 189 title_->SetBackgroundColor(0);
188 title_->SetEnabledColor(kTitleColor);
189 190
190 const gfx::ShadowValue kTitleShadows[] = { 191 if (internal::AppList::UseAppListV2()) {
191 gfx::ShadowValue(gfx::Point(0, 0), 1, SkColorSetARGB(0x66, 0, 0, 0)), 192 title_->SetEnabledColor(kTitleColorV2);
192 gfx::ShadowValue(gfx::Point(0, 0), 10, SkColorSetARGB(0x66, 0, 0, 0)), 193 } else {
193 gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x66, 0, 0, 0)), 194 title_->SetEnabledColor(kTitleColor);
194 gfx::ShadowValue(gfx::Point(0, 2), 4, SkColorSetARGB(0x66, 0, 0, 0)), 195 const gfx::ShadowValue kTitleShadows[] = {
195 }; 196 gfx::ShadowValue(gfx::Point(0, 0), 1, SkColorSetARGB(0x66, 0, 0, 0)),
196 title_->SetTextShadows(arraysize(kTitleShadows), kTitleShadows); 197 gfx::ShadowValue(gfx::Point(0, 0), 10, SkColorSetARGB(0x66, 0, 0, 0)),
198 gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x66, 0, 0, 0)),
199 gfx::ShadowValue(gfx::Point(0, 2), 4, SkColorSetARGB(0x66, 0, 0, 0)),
200 };
201 title_->SetTextShadows(arraysize(kTitleShadows), kTitleShadows);
202 }
197 203
198 AddChildView(icon_); 204 AddChildView(icon_);
199 AddChildView(title_); 205 AddChildView(title_);
200 206
201 ItemIconChanged(); 207 ItemIconChanged();
202 ItemTitleChanged(); 208 ItemTitleChanged();
203 model_->AddObserver(this); 209 model_->AddObserver(this);
204 210
205 set_context_menu_controller(this); 211 set_context_menu_controller(this);
206 set_request_focus_on_press(false); 212 set_request_focus_on_press(false);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 void AppListItemView::StateChanged() { 394 void AppListItemView::StateChanged() {
389 if (state() == BS_HOT || state() == BS_PUSHED) { 395 if (state() == BS_HOT || state() == BS_PUSHED) {
390 list_model_view_->SetSelectedItem(this); 396 list_model_view_->SetSelectedItem(this);
391 } else { 397 } else {
392 list_model_view_->ClearSelectedItem(this); 398 list_model_view_->ClearSelectedItem(this);
393 model_->SetHighlighted(false); 399 model_->SetHighlighted(false);
394 } 400 }
395 } 401 }
396 402
397 } // namespace ash 403 } // namespace ash
OLDNEW
« no previous file with comments | « ash/app_list/app_list_bubble_border.cc ('k') | ash/app_list/app_list_model_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698