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

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

Issue 10828151: chrome: Copy app_list files from views/ to ash/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 ExtensionResource;
16 class Profile;
17 class SkBitmap;
18
19 namespace extensions {
20 class Extension;
21 }
22
23 // ExtensionAppItem represents an extension app in app list.
24 class ExtensionAppItem : public ChromeAppListItem,
25 public ImageLoadingTracker::Observer,
26 public ui::SimpleMenuModel::Delegate {
27 public:
28 ExtensionAppItem(Profile* profile, const extensions::Extension* extension);
29 virtual ~ExtensionAppItem();
30
31 // Gets extension associated with this model. Returns NULL if extension
32 // no longer exists.
33 const extensions::Extension* GetExtension() const;
34
35 const std::string& extension_id() const {
36 return extension_id_;
37 }
38
39 private:
40 // Loads extension icon.
41 void LoadImage(const extensions::Extension* extension);
42
43 void ShowExtensionOptions();
44 void StartExtensionUninstall();
45
46 // Overridden from ImageLoadingTracker::Observer:
47 virtual void OnImageLoaded(const gfx::Image& image,
48 const std::string& extension_id,
49 int tracker_index) OVERRIDE;
50
51 // Overridden from ui::SimpleMenuModel::Delegate:
52 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
53 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
54 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
55 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
56 virtual bool GetAcceleratorForCommandId(
57 int command_id,
58 ui::Accelerator* acclelrator) OVERRIDE;
59 virtual void ExecuteCommand(int command_id) OVERRIDE;
60
61 // Overridden from ChromeAppListItem:
62 virtual void Activate(int event_flags) OVERRIDE;
63 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE;
64
65 Profile* profile_;
66 const std::string extension_id_;
67
68 scoped_ptr<ImageLoadingTracker> tracker_;
69 scoped_ptr<ui::SimpleMenuModel> context_menu_model_;
70
71 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem);
72 };
73
74 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_EXTENSION_APP_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698