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_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 22 matching lines...) Expand all Loading... | |
| 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. |
| 37 void AppendExtensionItems(const std::string& extension_id, | 37 void AppendExtensionItems(const std::string& extension_id, |
| 38 const string16& selection_text, | 38 const string16& selection_text, |
| 39 int* index); | 39 int* index); |
| 40 | 40 |
| 41 void Clear(); | 41 void Clear(); |
| 42 | 42 |
| 43 // This function returns the top level context menu title of an extension | |
| 44 // based on a printable selection text. | |
| 45 std::string GetTopLevelContextMenuTitle(const std::string& extension_id, | |
| 46 const string16& selection_text); | |
|
Avi (use Gerrit)
2013/06/05 14:34:10
If this returns a string visible in the UI, then i
François Beaufort
2013/06/06 09:07:37
This function doesn't return a string visible in t
| |
| 47 | |
| 43 bool IsCommandIdChecked(int command_id) const; | 48 bool IsCommandIdChecked(int command_id) const; |
| 44 bool IsCommandIdEnabled(int command_id) const; | 49 bool IsCommandIdEnabled(int command_id) const; |
| 45 void ExecuteCommand(int command_id, | 50 void ExecuteCommand(int command_id, |
| 46 content::WebContents* web_contents, | 51 content::WebContents* web_contents, |
| 47 const content::ContextMenuParams& params); | 52 const content::ContextMenuParams& params); |
| 48 | 53 |
| 49 private: | 54 private: |
| 50 friend class ::ExtensionContextMenuBrowserTest; | 55 friend class ::ExtensionContextMenuBrowserTest; |
| 51 | 56 |
| 57 bool GetRelevantExtensionTopLevelItems( | |
| 58 const std::string& extension_id, | |
| 59 const Extension** extension, | |
| 60 bool* can_cross_incognito, | |
| 61 MenuItem::List& items); | |
| 62 | |
| 52 MenuItem::List GetRelevantExtensionItems( | 63 MenuItem::List GetRelevantExtensionItems( |
| 53 const MenuItem::List& items, | 64 const MenuItem::List& items, |
| 54 bool can_cross_incognito); | 65 bool can_cross_incognito); |
| 55 | 66 |
| 56 // Used for recursively adding submenus of extension items. | 67 // Used for recursively adding submenus of extension items. |
| 57 void RecursivelyAppendExtensionItems(const MenuItem::List& items, | 68 void RecursivelyAppendExtensionItems(const MenuItem::List& items, |
| 58 bool can_cross_incognito, | 69 bool can_cross_incognito, |
| 59 const string16& selection_text, | 70 const string16& selection_text, |
| 60 ui::SimpleMenuModel* menu_model, | 71 ui::SimpleMenuModel* menu_model, |
| 61 int* index); | 72 int* index); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 77 | 88 |
| 78 // Keep track of and clean up menu models for submenus. | 89 // Keep track of and clean up menu models for submenus. |
| 79 ScopedVector<ui::SimpleMenuModel> extension_menu_models_; | 90 ScopedVector<ui::SimpleMenuModel> extension_menu_models_; |
| 80 | 91 |
| 81 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher); | 92 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher); |
| 82 }; | 93 }; |
| 83 | 94 |
| 84 } // namespace extensions | 95 } // namespace extensions |
| 85 | 96 |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ |
| OLD | NEW |