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 // EnstensionKey is used to identify a menu item. If the menu item belongs to |
48 // A menu item can also belong to a <webview> inside an extension, | 48 // an extension, then |extension_id| will be non-zero. Alternatively, if the |
lazyboy
2015/06/19 20:34:59
|extension_id| will be non-empty you mean?
paulmeyer
2015/06/23 13:43:28
Done.
| |
49 // only in that case |webview_instance_id| would be | 49 // menu item belongs to a WebView, then |webview_embedder_process_id| and |
50 // non-zero (i.e. != guestview::kInstanceIDNone). | 50 // |webview_instance_id| will be non-zero. |
51 // TODO(paulmeyer): This should be called something else, since it is not just | |
52 // associated with extensions. | |
51 struct ExtensionKey { | 53 struct ExtensionKey { |
52 std::string extension_id; | 54 std::string extension_id; |
55 int webview_embedder_process_id; | |
53 int webview_instance_id; | 56 int webview_instance_id; |
54 | 57 |
55 ExtensionKey(); | 58 ExtensionKey(); |
56 ExtensionKey(const std::string& extension_id, int webview_instance_id); | |
57 explicit ExtensionKey(const std::string& extension_id); | 59 explicit ExtensionKey(const std::string& extension_id); |
60 ExtensionKey(int webview_embedder_process_id, int webview_instance_id); | |
58 | 61 |
59 bool operator==(const ExtensionKey& other) const; | 62 bool operator==(const ExtensionKey& other) const; |
60 bool operator!=(const ExtensionKey& other) const; | 63 bool operator!=(const ExtensionKey& other) const; |
61 bool operator<(const ExtensionKey& other) const; | 64 bool operator<(const ExtensionKey& other) const; |
62 | 65 |
63 bool empty() const; | 66 bool empty() const; |
64 }; | 67 }; |
65 | 68 |
66 // An Id uniquely identifies a context menu item registered by an extension. | 69 // An Id uniquely identifies a context menu item registered by an extension. |
67 struct Id { | 70 struct Id { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 | 404 |
402 // Owned by ExtensionSystem. | 405 // Owned by ExtensionSystem. |
403 StateStore* store_; | 406 StateStore* store_; |
404 | 407 |
405 DISALLOW_COPY_AND_ASSIGN(MenuManager); | 408 DISALLOW_COPY_AND_ASSIGN(MenuManager); |
406 }; | 409 }; |
407 | 410 |
408 } // namespace extensions | 411 } // namespace extensions |
409 | 412 |
410 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 413 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
OLD | NEW |