Chromium Code Reviews| 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. |
| 50 // non-zero (i.e. != guestview::kInstanceIDNone). | 50 |
| 51 struct ExtensionKey { | 51 struct ExtensionKey { |
| 52 std::string extension_id; | 52 std::string extension_id; |
| 53 int webview_embedder_process_id; | |
| 53 int webview_instance_id; | 54 int webview_instance_id; |
| 54 | 55 |
| 55 ExtensionKey(); | 56 ExtensionKey(); |
| 56 ExtensionKey(const std::string& extension_id, int webview_instance_id); | |
| 57 explicit ExtensionKey(const std::string& extension_id); | 57 explicit ExtensionKey(const std::string& extension_id); |
| 58 ExtensionKey(int webview_embedder_process_id, int webview_instance_id); | |
| 59 ExtensionKey(const std::string& extension_id, | |
|
Devlin
2015/06/18 19:39:57
If we allow matching based on view id and process
paulmeyer
2015/06/18 19:49:59
Okay. If I were to use that approach, would you wa
Devlin
2015/06/18 20:09:21
I think "Key" would be sufficient. If it's not an
paulmeyer
2015/06/19 17:57:28
I made the change and left a TODO for now. I will
| |
| 60 int webview_embedder_process_id, | |
| 61 int webview_instance_id); | |
| 58 | 62 |
| 59 bool operator==(const ExtensionKey& other) const; | 63 bool operator==(const ExtensionKey& other) const; |
| 60 bool operator!=(const ExtensionKey& other) const; | 64 bool operator!=(const ExtensionKey& other) const; |
| 61 bool operator<(const ExtensionKey& other) const; | 65 bool operator<(const ExtensionKey& other) const; |
| 62 | 66 |
| 63 bool empty() const; | 67 bool empty() const; |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 // An Id uniquely identifies a context menu item registered by an extension. | 70 // An Id uniquely identifies a context menu item registered by an extension. |
| 67 struct Id { | 71 struct Id { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 405 |
| 402 // Owned by ExtensionSystem. | 406 // Owned by ExtensionSystem. |
| 403 StateStore* store_; | 407 StateStore* store_; |
| 404 | 408 |
| 405 DISALLOW_COPY_AND_ASSIGN(MenuManager); | 409 DISALLOW_COPY_AND_ASSIGN(MenuManager); |
| 406 }; | 410 }; |
| 407 | 411 |
| 408 } // namespace extensions | 412 } // namespace extensions |
| 409 | 413 |
| 410 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 414 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
| OLD | NEW |