 Chromium Code Reviews
 Chromium Code Reviews Issue 359493005:
  Extend contextMenus API to support browser/page actions  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 359493005:
  Extend contextMenus API to support browser/page actions  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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_CONTEXT_MENU_MATCHER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 
| 6 #define CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
| 9 | 9 | 
| 10 #include "base/callback.h" | 10 #include "base/callback.h" | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 | 
| 27 // The |filter| will be called on possibly matching menu items, and its | 27 // The |filter| will be called on possibly matching menu items, and its | 
| 28 // result is used to determine which items to actually append to the menu. | 28 // result is used to determine which items to actually append to the menu. | 
| 29 ContextMenuMatcher(Profile* profile, | 29 ContextMenuMatcher(Profile* profile, | 
| 30 ui::SimpleMenuModel::Delegate* delegate, | 30 ui::SimpleMenuModel::Delegate* delegate, | 
| 31 ui::SimpleMenuModel* menu_model, | 31 ui::SimpleMenuModel* menu_model, | 
| 32 const base::Callback<bool(const MenuItem*)>& filter); | 32 const base::Callback<bool(const MenuItem*)>& filter); | 
| 33 | 33 | 
| 34 // This is a helper function to append items for one particular extension. | 34 // This is a helper function to append items for one particular extension. | 
| 35 // The |index| parameter is used for assigning id's, and is incremented for | 35 // The |index| parameter is used for assigning id's, and is incremented for | 
| 36 // each item actually added. | 36 // each item actually added. |include_icons| is used to determine whether | 
| 37 // the extension's icon should be included with the items. | |
| 
Yoyo Zhou
2014/07/15 23:35:00
"included with the items": does that mean "shown"?
 
gpdavis
2014/07/16 01:11:10
Done.
 | |
| 37 void AppendExtensionItems(const MenuItem::ExtensionKey& extension_key, | 38 void AppendExtensionItems(const MenuItem::ExtensionKey& extension_key, | 
| 38 const base::string16& selection_text, | 39 const base::string16& selection_text, | 
| 39 int* index); | 40 int* index, | 
| 41 bool include_icons); | |
| 40 | 42 | 
| 41 void Clear(); | 43 void Clear(); | 
| 42 | 44 | 
| 43 // This function returns the top level context menu title of an extension | 45 // This function returns the top level context menu title of an extension | 
| 44 // based on a printable selection text. | 46 // based on a printable selection text. | 
| 45 base::string16 GetTopLevelContextMenuTitle( | 47 base::string16 GetTopLevelContextMenuTitle( | 
| 46 const MenuItem::ExtensionKey& extension_key, | 48 const MenuItem::ExtensionKey& extension_key, | 
| 47 const base::string16& selection_text); | 49 const base::string16& selection_text); | 
| 48 | 50 | 
| 49 bool IsCommandIdChecked(int command_id) const; | 51 bool IsCommandIdChecked(int command_id) const; | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 91 | 
| 90 // Keep track of and clean up menu models for submenus. | 92 // Keep track of and clean up menu models for submenus. | 
| 91 ScopedVector<ui::SimpleMenuModel> extension_menu_models_; | 93 ScopedVector<ui::SimpleMenuModel> extension_menu_models_; | 
| 92 | 94 | 
| 93 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher); | 95 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher); | 
| 94 }; | 96 }; | 
| 95 | 97 | 
| 96 } // namespace extensions | 98 } // namespace extensions | 
| 97 | 99 | 
| 98 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 100 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 
| OLD | NEW |