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

Side by Side Diff: chrome/browser/extensions/extension_menu_manager.h

Issue 9382037: Move ContextMenuParams struct from webkit/glue to content/public/common. The reasons are: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 10 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
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 CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/string16.h" 18 #include "base/string16.h"
19 #include "chrome/browser/extensions/extension_icon_manager.h" 19 #include "chrome/browser/extensions/extension_icon_manager.h"
20 #include "chrome/common/extensions/url_pattern_set.h" 20 #include "chrome/common/extensions/url_pattern_set.h"
21 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 23
24 struct ContextMenuParams;
25 24
26 class Extension; 25 class Extension;
27 class Profile; 26 class Profile;
28 class SkBitmap; 27 class SkBitmap;
29 28
30 namespace content { 29 namespace content {
31 class WebContents; 30 class WebContents;
31 struct ContextMenuParams;
32 } 32 }
33 33
34 // Represents a menu item added by an extension. 34 // Represents a menu item added by an extension.
35 class ExtensionMenuItem { 35 class ExtensionMenuItem {
36 public: 36 public:
37 // A list of ExtensionMenuItem's. 37 // A list of ExtensionMenuItem's.
38 typedef std::vector<ExtensionMenuItem*> List; 38 typedef std::vector<ExtensionMenuItem*> List;
39 39
40 // An Id uniquely identifies a context menu item registered by an extension. 40 // An Id uniquely identifies a context menu item registered by an extension.
41 struct Id { 41 struct Id {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ExtensionMenuItem* GetItemById(const ExtensionMenuItem::Id& id) const; 240 ExtensionMenuItem* GetItemById(const ExtensionMenuItem::Id& id) const;
241 241
242 // Notify the ExtensionMenuManager that an item has been updated not through 242 // Notify the ExtensionMenuManager that an item has been updated not through
243 // an explicit call into ExtensionMenuManager. For example, if an item is 243 // an explicit call into ExtensionMenuManager. For example, if an item is
244 // acquired by a call to GetItemById and changed, then this should be called. 244 // acquired by a call to GetItemById and changed, then this should be called.
245 // Returns true if the item was found or false otherwise. 245 // Returns true if the item was found or false otherwise.
246 bool ItemUpdated(const ExtensionMenuItem::Id& id); 246 bool ItemUpdated(const ExtensionMenuItem::Id& id);
247 247
248 // Called when a menu item is clicked on by the user. 248 // Called when a menu item is clicked on by the user.
249 void ExecuteCommand(Profile* profile, content::WebContents* web_contents, 249 void ExecuteCommand(Profile* profile, content::WebContents* web_contents,
250 const ContextMenuParams& params, 250 const content::ContextMenuParams& params,
251 const ExtensionMenuItem::Id& menuItemId); 251 const ExtensionMenuItem::Id& menuItemId);
252 252
253 // This returns a bitmap of width/height kFaviconSize, loaded either from an 253 // This returns a bitmap of width/height kFaviconSize, loaded either from an
254 // entry specified in the extension's 'icon' section of the manifest, or a 254 // entry specified in the extension's 'icon' section of the manifest, or a
255 // default extension icon. 255 // default extension icon.
256 const SkBitmap& GetIconForExtension(const std::string& extension_id); 256 const SkBitmap& GetIconForExtension(const std::string& extension_id);
257 257
258 // Implements the content::NotificationObserver interface. 258 // Implements the content::NotificationObserver interface.
259 virtual void Observe(int type, const content::NotificationSource& source, 259 virtual void Observe(int type, const content::NotificationSource& source,
260 const content::NotificationDetails& details) OVERRIDE; 260 const content::NotificationDetails& details) OVERRIDE;
(...skipping 26 matching lines...) Expand all
287 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; 287 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_;
288 288
289 content::NotificationRegistrar registrar_; 289 content::NotificationRegistrar registrar_;
290 290
291 ExtensionIconManager icon_manager_; 291 ExtensionIconManager icon_manager_;
292 292
293 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); 293 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager);
294 }; 294 };
295 295
296 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ 296 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698