Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 243 |
| 244 // This returns a bitmap of width/height kFaviconSize, loaded either from an | 244 // This returns a bitmap of width/height kFaviconSize, loaded either from an |
| 245 // entry specified in the extension's 'icon' section of the manifest, or a | 245 // entry specified in the extension's 'icon' section of the manifest, or a |
| 246 // default extension icon. | 246 // default extension icon. |
| 247 const SkBitmap& GetIconForExtension(const std::string& extension_id); | 247 const SkBitmap& GetIconForExtension(const std::string& extension_id); |
| 248 | 248 |
| 249 // Implements the content::NotificationObserver interface. | 249 // Implements the content::NotificationObserver interface. |
| 250 virtual void Observe(int type, const content::NotificationSource& source, | 250 virtual void Observe(int type, const content::NotificationSource& source, |
| 251 const content::NotificationDetails& details) OVERRIDE; | 251 const content::NotificationDetails& details) OVERRIDE; |
| 252 | 252 |
| 253 // Sanitize radio buttons so that and run of radio buttons does not | |
|
asargent_no_longer_on_chrome
2011/12/15 18:38:40
typo: "and run" -> "a run"
| |
| 254 // enter a state where none are checked. | |
| 255 void SanitizeRadioButtons(); | |
| 256 | |
| 253 private: | 257 private: |
| 254 FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, DeleteParent); | 258 FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, DeleteParent); |
| 255 FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, RemoveOneByOne); | 259 FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, RemoveOneByOne); |
| 256 | 260 |
| 257 // This is a helper function which takes care of de-selecting any other radio | 261 // This is a helper function which takes care of de-selecting any other radio |
| 258 // items in the same group (i.e. that are adjacent in the list). | 262 // items in the same group (i.e. that are adjacent in the list). |
| 259 void RadioItemSelected(ExtensionMenuItem* item); | 263 void RadioItemSelected(ExtensionMenuItem* item); |
| 260 | 264 |
| 261 // Returns true if item is a descendant of an item with id |ancestor_id|. | 265 // Returns true if item is a descendant of an item with id |ancestor_id|. |
| 262 bool DescendantOf(ExtensionMenuItem* item, | 266 bool DescendantOf(ExtensionMenuItem* item, |
| 263 const ExtensionMenuItem::Id& ancestor_id); | 267 const ExtensionMenuItem::Id& ancestor_id); |
| 264 | 268 |
| 269 // Recursivly looks for a run of radio items. If on is found that | |
|
asargent_no_longer_on_chrome
2011/12/15 18:38:40
typo: "Recursivly" -> "Recursively"
typo: "If on"
| |
| 270 // does not have any selected item, select the first one. | |
| 271 void RecursiveSanitizeRadioButtons(const ExtensionMenuItem::List& item_list); | |
| 272 | |
| 265 // We keep items organized by mapping an extension id to a list of items. | 273 // We keep items organized by mapping an extension id to a list of items. |
| 266 typedef std::map<std::string, ExtensionMenuItem::List> MenuItemMap; | 274 typedef std::map<std::string, ExtensionMenuItem::List> MenuItemMap; |
| 267 MenuItemMap context_items_; | 275 MenuItemMap context_items_; |
| 268 | 276 |
| 269 // This lets us make lookup by id fast. It maps id to ExtensionMenuItem* for | 277 // This lets us make lookup by id fast. It maps id to ExtensionMenuItem* for |
| 270 // all items the menu manager knows about, including all children of top-level | 278 // all items the menu manager knows about, including all children of top-level |
| 271 // items. | 279 // items. |
| 272 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; | 280 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; |
| 273 | 281 |
| 274 content::NotificationRegistrar registrar_; | 282 content::NotificationRegistrar registrar_; |
| 275 | 283 |
| 276 ExtensionIconManager icon_manager_; | 284 ExtensionIconManager icon_manager_; |
| 277 | 285 |
| 278 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); | 286 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); |
| 279 }; | 287 }; |
| 280 | 288 |
| 281 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ | 289 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
| OLD | NEW |