Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/extensions/context_menu_matcher.h

Issue 12299013: Fix top-level context menus sorting by name (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: I have no excuse here... Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/context_menu_matcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 base::string16 GetTopLevelContextMenuTitle(const std::string& extension_id,
46 const string16& selection_text);
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/context_menu_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698