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 CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 bool operator==(const Id& other) const; | 54 bool operator==(const Id& other) const; |
55 bool operator!=(const Id& other) const; | 55 bool operator!=(const Id& other) const; |
56 bool operator<(const Id& other) const; | 56 bool operator<(const Id& other) const; |
57 | 57 |
58 bool incognito; | 58 bool incognito; |
59 std::string extension_id; | 59 std::string extension_id; |
60 // Only one of uid or string_uid will be defined. | 60 // Only one of uid or string_uid will be defined. |
61 int uid; | 61 int uid; |
62 std::string string_uid; | 62 std::string string_uid; |
| 63 int webview_instance_id; |
63 }; | 64 }; |
64 | 65 |
65 // For context menus, these are the contexts where an item can appear. | 66 // For context menus, these are the contexts where an item can appear. |
66 enum Context { | 67 enum Context { |
67 ALL = 1, | 68 ALL = 1, |
68 PAGE = 2, | 69 PAGE = 2, |
69 SELECTION = 4, | 70 SELECTION = 4, |
70 LINK = 8, | 71 LINK = 8, |
71 EDITABLE = 16, | 72 EDITABLE = 16, |
72 IMAGE = 32, | 73 IMAGE = 32, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const MenuItem::Id* parent_id); | 284 const MenuItem::Id* parent_id); |
284 | 285 |
285 // Removes a context menu item with the given id (whether it is a top-level | 286 // Removes a context menu item with the given id (whether it is a top-level |
286 // item or a child of some other item), returning true if the item was found | 287 // item or a child of some other item), returning true if the item was found |
287 // and removed or false otherwise. | 288 // and removed or false otherwise. |
288 bool RemoveContextMenuItem(const MenuItem::Id& id); | 289 bool RemoveContextMenuItem(const MenuItem::Id& id); |
289 | 290 |
290 // Removes all items for the given extension id. | 291 // Removes all items for the given extension id. |
291 void RemoveAllContextItems(const std::string& extension_id); | 292 void RemoveAllContextItems(const std::string& extension_id); |
292 | 293 |
| 294 // Remove all items that belong to a <webview> guest within an extension. |
| 295 void RemoveAllWebviewContextItems(const std::string& extension_id, |
| 296 int webview_instance_id); |
| 297 |
293 // Returns the item with the given |id| or NULL. | 298 // Returns the item with the given |id| or NULL. |
294 MenuItem* GetItemById(const MenuItem::Id& id) const; | 299 MenuItem* GetItemById(const MenuItem::Id& id) const; |
295 | 300 |
296 // Notify the MenuManager that an item has been updated not through | 301 // Notify the MenuManager that an item has been updated not through |
297 // an explicit call into MenuManager. For example, if an item is | 302 // an explicit call into MenuManager. For example, if an item is |
298 // acquired by a call to GetItemById and changed, then this should be called. | 303 // acquired by a call to GetItemById and changed, then this should be called. |
299 // Returns true if the item was found or false otherwise. | 304 // Returns true if the item was found or false otherwise. |
300 bool ItemUpdated(const MenuItem::Id& id); | 305 bool ItemUpdated(const MenuItem::Id& id); |
301 | 306 |
302 // Called when a menu item is clicked on by the user. | 307 // Called when a menu item is clicked on by the user. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 364 |
360 // Owned by ExtensionSystem. | 365 // Owned by ExtensionSystem. |
361 StateStore* store_; | 366 StateStore* store_; |
362 | 367 |
363 DISALLOW_COPY_AND_ASSIGN(MenuManager); | 368 DISALLOW_COPY_AND_ASSIGN(MenuManager); |
364 }; | 369 }; |
365 | 370 |
366 } // namespace extensions | 371 } // namespace extensions |
367 | 372 |
368 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 373 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
OLD | NEW |