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

Side by Side Diff: chrome/browser/ui/ash/app_list/extension_app_item.h

Issue 10871011: Move common app_list delegate code to chrome/browser/ui/app_list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit test file only in chrome Created 8 years, 4 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
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 CHROME_BROWSER_UI_ASH_APP_LIST_EXTENSION_APP_ITEM_H_
6 #define CHROME_BROWSER_UI_ASH_APP_LIST_EXTENSION_APP_ITEM_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/extensions/image_loading_tracker.h"
12 #include "chrome/browser/ui/ash/app_list/chrome_app_list_item.h"
13 #include "ui/base/models/simple_menu_model.h"
14
15 class AppListController;
16 class ExtensionResource;
17 class Profile;
18 class SkBitmap;
19
20 namespace extensions {
21 class Extension;
22 }
23
24 // ExtensionAppItem represents an extension app in app list.
25 class ExtensionAppItem : public ChromeAppListItem,
26 public ImageLoadingTracker::Observer,
27 public ui::SimpleMenuModel::Delegate {
28 public:
29 ExtensionAppItem(Profile* profile,
30 const extensions::Extension* extension,
31 AppListController* controller);
32 virtual ~ExtensionAppItem();
33
34 // Gets extension associated with this model. Returns NULL if extension
35 // no longer exists.
36 const extensions::Extension* GetExtension() const;
37
38 const std::string& extension_id() const {
39 return extension_id_;
40 }
41
42 private:
43 // Loads extension icon.
44 void LoadImage(const extensions::Extension* extension);
45
46 void ShowExtensionOptions();
47 void ShowExtensionDetails();
48 void StartExtensionUninstall();
49
50 // Overridden from ImageLoadingTracker::Observer:
51 virtual void OnImageLoaded(const gfx::Image& image,
52 const std::string& extension_id,
53 int tracker_index) OVERRIDE;
54
55 // Overridden from ui::SimpleMenuModel::Delegate:
56 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
57 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
58 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
59 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
60 virtual bool GetAcceleratorForCommandId(
61 int command_id,
62 ui::Accelerator* acclelrator) OVERRIDE;
63 virtual void ExecuteCommand(int command_id) OVERRIDE;
64
65 // Overridden from ChromeAppListItem:
66 virtual void Activate(int event_flags) OVERRIDE;
67 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE;
68
69 Profile* profile_;
70 const std::string extension_id_;
71 AppListController* controller_;
72
73 scoped_ptr<ImageLoadingTracker> tracker_;
74 scoped_ptr<ui::SimpleMenuModel> context_menu_model_;
75
76 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem);
77 };
78
79 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_EXTENSION_APP_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/app_list/chrome_app_list_item.h ('k') | chrome/browser/ui/ash/app_list/extension_app_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698