| 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 26 matching lines...) Expand all Loading... |
| 37 class Extension; | 37 class Extension; |
| 38 class ExtensionRegistry; | 38 class ExtensionRegistry; |
| 39 class StateStore; | 39 class StateStore; |
| 40 | 40 |
| 41 // Represents a menu item added by an extension. | 41 // Represents a menu item added by an extension. |
| 42 class MenuItem { | 42 class MenuItem { |
| 43 public: | 43 public: |
| 44 // A list of MenuItems. | 44 // A list of MenuItems. |
| 45 typedef std::vector<MenuItem*> List; | 45 typedef std::vector<MenuItem*> List; |
| 46 | 46 |
| 47 // Key used to identify which extension a menu item belongs to. | 47 // Key used to identify which extension a menu item belongs to. A menu item |
| 48 // A menu item can also belong to a <webview> inside an extension, | 48 // can also belong to a <webview>, in which case |webview_embedder_process_id| |
| 49 // only in that case |webview_instance_id| would be | 49 // and |webview_instance_id| will be non-zero. When two ExtensionKeys are |
| 50 // non-zero (i.e. != guestview::kInstanceIDNone). | 50 // compared, an empty |extension_id| will match any other extension ID. This |
| 51 // allows menu items belonging to webviews to be found with only the two |
| 52 // webview IDs when the extension ID is not known. This is currently done from |
| 53 // ChromeExtensionsBrowserClient::CleanUpWebView(). |
| 51 struct ExtensionKey { | 54 struct ExtensionKey { |
| 52 std::string extension_id; | 55 std::string extension_id; |
| 56 int webview_embedder_process_id; |
| 53 int webview_instance_id; | 57 int webview_instance_id; |
| 54 | 58 |
| 55 ExtensionKey(); | 59 ExtensionKey(); |
| 56 ExtensionKey(const std::string& extension_id, int webview_instance_id); | |
| 57 explicit ExtensionKey(const std::string& extension_id); | 60 explicit ExtensionKey(const std::string& extension_id); |
| 61 ExtensionKey(const std::string& extension_id, |
| 62 int webview_embedder_process_id, |
| 63 int webview_instance_id); |
| 58 | 64 |
| 59 bool operator==(const ExtensionKey& other) const; | 65 bool operator==(const ExtensionKey& other) const; |
| 60 bool operator!=(const ExtensionKey& other) const; | 66 bool operator!=(const ExtensionKey& other) const; |
| 61 bool operator<(const ExtensionKey& other) const; | 67 bool operator<(const ExtensionKey& other) const; |
| 62 | 68 |
| 63 bool empty() const; | 69 bool empty() const; |
| 64 }; | 70 }; |
| 65 | 71 |
| 66 // An Id uniquely identifies a context menu item registered by an extension. | 72 // An Id uniquely identifies a context menu item registered by an extension. |
| 67 struct Id { | 73 struct Id { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 407 |
| 402 // Owned by ExtensionSystem. | 408 // Owned by ExtensionSystem. |
| 403 StateStore* store_; | 409 StateStore* store_; |
| 404 | 410 |
| 405 DISALLOW_COPY_AND_ASSIGN(MenuManager); | 411 DISALLOW_COPY_AND_ASSIGN(MenuManager); |
| 406 }; | 412 }; |
| 407 | 413 |
| 408 } // namespace extensions | 414 } // namespace extensions |
| 409 | 415 |
| 410 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 416 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
| OLD | NEW |