| OLD | NEW |
| 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/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_view_state.h" |
| 12 #include "ui/app_list/app_list_constants.h" | 12 #include "ui/app_list/app_list_constants.h" |
| 13 #include "ui/app_list/app_list_folder_item.h" | 13 #include "ui/app_list/app_list_folder_item.h" |
| 14 #include "ui/app_list/app_list_item.h" | 14 #include "ui/app_list/app_list_item.h" |
| 15 #include "ui/app_list/views/apps_grid_view.h" | 15 #include "ui/app_list/views/apps_grid_view.h" |
| 16 #include "ui/app_list/views/cached_label.h" | 16 #include "ui/app_list/views/cached_label.h" |
| 17 #include "ui/app_list/views/progress_bar_view.h" | 17 #include "ui/app_list/views/progress_bar_view.h" |
| 18 #include "ui/base/dragdrop/drag_utils.h" | 18 #include "ui/base/dragdrop/drag_utils.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/base/ui_base_switches_util.h" | 21 #include "ui/base/ui_base_switches_util.h" |
| 22 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 23 #include "ui/compositor/scoped_layer_animation_settings.h" | 23 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 24 #include "ui/gfx/animation/throb_animation.h" | 24 #include "ui/gfx/animation/throb_animation.h" |
| 25 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 26 #include "ui/gfx/font_list.h" | 26 #include "ui/gfx/font_list.h" |
| 27 #include "ui/gfx/geometry/point.h" | 27 #include "ui/gfx/geometry/point.h" |
| 28 #include "ui/gfx/geometry/vector2d.h" |
| 28 #include "ui/gfx/image/image_skia_operations.h" | 29 #include "ui/gfx/image/image_skia_operations.h" |
| 29 #include "ui/gfx/shadow_value.h" | 30 #include "ui/gfx/shadow_value.h" |
| 30 #include "ui/gfx/transform_util.h" | 31 #include "ui/gfx/transform_util.h" |
| 31 #include "ui/strings/grit/ui_strings.h" | 32 #include "ui/strings/grit/ui_strings.h" |
| 32 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
| 33 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
| 34 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
| 35 #include "ui/views/controls/menu/menu_runner.h" | 36 #include "ui/views/controls/menu/menu_runner.h" |
| 36 #include "ui/views/drag_controller.h" | 37 #include "ui/views/drag_controller.h" |
| 37 | 38 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 const int kLeftRightPaddingChars = 1; | 50 const int kLeftRightPaddingChars = 1; |
| 50 | 51 |
| 51 // Scale to transform the icon when a drag starts. | 52 // Scale to transform the icon when a drag starts. |
| 52 const float kDraggingIconScale = 1.5f; | 53 const float kDraggingIconScale = 1.5f; |
| 53 | 54 |
| 54 // Delay in milliseconds of when the dragging UI should be shown for mouse drag. | 55 // Delay in milliseconds of when the dragging UI should be shown for mouse drag. |
| 55 const int kMouseDragUIDelayInMs = 200; | 56 const int kMouseDragUIDelayInMs = 200; |
| 56 | 57 |
| 57 const gfx::ShadowValues& GetIconShadows() { | 58 const gfx::ShadowValues& GetIconShadows() { |
| 58 CR_DEFINE_STATIC_LOCAL( | 59 CR_DEFINE_STATIC_LOCAL(const gfx::ShadowValues, icon_shadows, |
| 59 const gfx::ShadowValues, | 60 (1, gfx::ShadowValue(gfx::Vector2d(0, 2), 2, |
| 60 icon_shadows, | 61 SkColorSetARGB(0x24, 0, 0, 0)))); |
| 61 (1, | |
| 62 gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)))); | |
| 63 return icon_shadows; | 62 return icon_shadows; |
| 64 } | 63 } |
| 65 | 64 |
| 66 gfx::FontList GetFontList() { | 65 gfx::FontList GetFontList() { |
| 67 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 66 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 68 const gfx::FontList& font_list = rb.GetFontList(kItemTextFontStyle); | 67 const gfx::FontList& font_list = rb.GetFontList(kItemTextFontStyle); |
| 69 // The font is different on each platform. The font size is adjusted on some | 68 // The font is different on each platform. The font size is adjusted on some |
| 70 // platforms to keep a consistent look. | 69 // platforms to keep a consistent look. |
| 71 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 70 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 72 // Reducing the font size by 2 makes it the same as the Windows font size. | 71 // Reducing the font size by 2 makes it the same as the Windows font size. |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 SetItemPercentDownloaded(item_weak_->percent_downloaded()); | 588 SetItemPercentDownloaded(item_weak_->percent_downloaded()); |
| 590 } | 589 } |
| 591 | 590 |
| 592 void AppListItemView::ItemBeingDestroyed() { | 591 void AppListItemView::ItemBeingDestroyed() { |
| 593 DCHECK(item_weak_); | 592 DCHECK(item_weak_); |
| 594 item_weak_->RemoveObserver(this); | 593 item_weak_->RemoveObserver(this); |
| 595 item_weak_ = NULL; | 594 item_weak_ = NULL; |
| 596 } | 595 } |
| 597 | 596 |
| 598 } // namespace app_list | 597 } // namespace app_list |
| OLD | NEW |