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

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

Issue 10388032: Move app list from ash to ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix win_aura bot and comments in #5 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_item_model_observer.h ('k') | ash/app_list/app_list_item_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_
6 #define ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_
7 #pragma once
8
9 #include "ash/app_list/app_list_item_model_observer.h"
10 #include "ash/ash_export.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "ui/views/context_menu_controller.h"
15 #include "ui/views/controls/button/custom_button.h"
16
17 class SkBitmap;
18
19 namespace views {
20 class ImageView;
21 class MenuRunner;
22 }
23
24 namespace ash {
25
26 class AppListItemModel;
27 class AppListModelView;
28 class DropShadowLabel;
29
30 class ASH_EXPORT AppListItemView : public views::CustomButton,
31 public views::ContextMenuController,
32 public AppListItemModelObserver {
33 public:
34 AppListItemView(AppListModelView* list_model_view,
35 AppListItemModel* model,
36 views::ButtonListener* listener);
37 virtual ~AppListItemView();
38
39 static gfx::Size GetPreferredSizeForIconSize(const gfx::Size& icon_size);
40
41 // For testing. Testing calls this function to set minimum title width in
42 // pixels to get rid dependency on default font width.
43 static void SetMinTitleWidth(int width);
44
45 void SetSelected(bool selected);
46 bool selected() const {
47 return selected_;
48 }
49
50 void SetIconSize(const gfx::Size& size);
51
52 AppListItemModel* model() const {
53 return model_;
54 }
55
56 // Internal class name.
57 static const char kViewClassName[];
58
59 private:
60 class IconOperation;
61
62 // Get icon from model and schedule background processing.
63 void UpdateIcon();
64
65 // Cancel pending icon operation and reply callback.
66 void CancelPendingIconOperation();
67
68 // Reply callback from background shadow generation. |op| is the finished
69 // operation and holds the result image.
70 void ApplyShadow(scoped_refptr<IconOperation> op);
71
72 // AppListItemModelObserver overrides:
73 virtual void ItemIconChanged() OVERRIDE;
74 virtual void ItemTitleChanged() OVERRIDE;
75 virtual void ItemHighlightedChanged() OVERRIDE;
76
77 // views::View overrides:
78 virtual std::string GetClassName() const OVERRIDE;
79 virtual gfx::Size GetPreferredSize() OVERRIDE;
80 virtual void Layout() OVERRIDE;
81 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
82 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
83
84 // views::ContextMenuController overrides:
85 virtual void ShowContextMenuForView(views::View* source,
86 const gfx::Point& point) OVERRIDE;
87
88 // views::CustomButton overrides:
89 virtual void StateChanged() OVERRIDE;
90
91 AppListItemModel* model_;
92
93 AppListModelView* list_model_view_;
94 views::ImageView* icon_;
95 DropShadowLabel* title_;
96
97 scoped_ptr<views::MenuRunner> context_menu_runner_;
98
99 gfx::Size icon_size_;
100 bool selected_;
101
102 scoped_refptr<IconOperation> icon_op_;
103 base::WeakPtrFactory<AppListItemView> apply_shadow_factory_;
104
105 DISALLOW_COPY_AND_ASSIGN(AppListItemView);
106 };
107
108 } // namespace ash
109
110 #endif // ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_
OLDNEW
« no previous file with comments | « ash/app_list/app_list_item_model_observer.h ('k') | ash/app_list/app_list_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698