| 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 #ifndef UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
| 6 #define UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" |
| 15 #include "ui/app_list/app_list_item_model_observer.h" | 15 #include "ui/app_list/app_list_item_model_observer.h" |
| 16 #include "ui/views/context_menu_controller.h" | 16 #include "ui/views/context_menu_controller.h" |
| 17 #include "ui/views/controls/button/custom_button.h" | 17 #include "ui/views/controls/button/custom_button.h" |
| 18 | 18 |
| 19 class SkBitmap; | 19 class SkBitmap; |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class ImageView; | 22 class ImageView; |
| 23 class MenuRunner; | 23 class MenuRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace app_list { | 26 namespace app_list { |
| 27 | 27 |
| 28 class AppListItemModel; | 28 class AppListItemModel; |
| 29 class AppListModelView; | 29 class AppsGridView; |
| 30 class DropShadowLabel; | 30 class DropShadowLabel; |
| 31 | 31 |
| 32 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, | 32 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, |
| 33 public views::ContextMenuController, | 33 public views::ContextMenuController, |
| 34 public AppListItemModelObserver { | 34 public AppListItemModelObserver { |
| 35 public: | 35 public: |
| 36 AppListItemView(AppListModelView* list_model_view, | 36 AppListItemView(AppsGridView* list_model_view, |
| 37 AppListItemModel* model, | 37 AppListItemModel* model, |
| 38 views::ButtonListener* listener); | 38 views::ButtonListener* listener); |
| 39 virtual ~AppListItemView(); | 39 virtual ~AppListItemView(); |
| 40 | 40 |
| 41 static gfx::Size GetPreferredSizeForIconSize(const gfx::Size& icon_size); | 41 static gfx::Size GetPreferredSizeForIconSize(const gfx::Size& icon_size); |
| 42 | 42 |
| 43 // For testing. Testing calls this function to set minimum title width in | 43 // For testing. Testing calls this function to set minimum title width in |
| 44 // pixels to get rid dependency on default font width. | 44 // pixels to get rid dependency on default font width. |
| 45 static void SetMinTitleWidth(int width); | 45 static void SetMinTitleWidth(int width); |
| 46 | 46 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // views::ContextMenuController overrides: | 86 // views::ContextMenuController overrides: |
| 87 virtual void ShowContextMenuForView(views::View* source, | 87 virtual void ShowContextMenuForView(views::View* source, |
| 88 const gfx::Point& point) OVERRIDE; | 88 const gfx::Point& point) OVERRIDE; |
| 89 | 89 |
| 90 // views::CustomButton overrides: | 90 // views::CustomButton overrides: |
| 91 virtual void StateChanged() OVERRIDE; | 91 virtual void StateChanged() OVERRIDE; |
| 92 | 92 |
| 93 AppListItemModel* model_; | 93 AppListItemModel* model_; |
| 94 | 94 |
| 95 AppListModelView* list_model_view_; | 95 AppsGridView* list_model_view_; |
| 96 views::ImageView* icon_; | 96 views::ImageView* icon_; |
| 97 DropShadowLabel* title_; | 97 DropShadowLabel* title_; |
| 98 | 98 |
| 99 scoped_ptr<views::MenuRunner> context_menu_runner_; | 99 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 100 | 100 |
| 101 gfx::Size icon_size_; | 101 gfx::Size icon_size_; |
| 102 bool selected_; | 102 bool selected_; |
| 103 | 103 |
| 104 scoped_refptr<IconOperation> icon_op_; | 104 scoped_refptr<IconOperation> icon_op_; |
| 105 base::WeakPtrFactory<AppListItemView> apply_shadow_factory_; | 105 base::WeakPtrFactory<AppListItemView> apply_shadow_factory_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 107 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace app_list | 110 } // namespace app_list |
| 111 | 111 |
| 112 #endif // UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 112 #endif // UI_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
| OLD | NEW |