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

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

Issue 1772513002: Add frameId to contextMenus.onClicked / onclick. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "chrome/browser/extensions/menu_manager.h" 16 #include "chrome/browser/extensions/menu_manager.h"
17 #include "ui/base/models/simple_menu_model.h" 17 #include "ui/base/models/simple_menu_model.h"
18 18
19 class ExtensionContextMenuBrowserTest; 19 class ExtensionContextMenuBrowserTest;
20 20
21 namespace content { 21 namespace content {
22 class BrowserContext; 22 class BrowserContext;
23 class RenderFrameHost;
23 } 24 }
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 // This class contains code that is shared between the various places where 28 // This class contains code that is shared between the various places where
28 // context menu items added by the extension or app should be shown. 29 // context menu items added by the extension or app should be shown.
29 class ContextMenuMatcher { 30 class ContextMenuMatcher {
30 public: 31 public:
31 static const size_t kMaxExtensionItemTitleLength; 32 static const size_t kMaxExtensionItemTitleLength;
32 33
(...skipping 26 matching lines...) Expand all
59 // This function returns the top level context menu title of an extension 60 // This function returns the top level context menu title of an extension
60 // based on a printable selection text. 61 // based on a printable selection text.
61 base::string16 GetTopLevelContextMenuTitle( 62 base::string16 GetTopLevelContextMenuTitle(
62 const MenuItem::ExtensionKey& extension_key, 63 const MenuItem::ExtensionKey& extension_key,
63 const base::string16& selection_text); 64 const base::string16& selection_text);
64 65
65 bool IsCommandIdChecked(int command_id) const; 66 bool IsCommandIdChecked(int command_id) const;
66 bool IsCommandIdEnabled(int command_id) const; 67 bool IsCommandIdEnabled(int command_id) const;
67 void ExecuteCommand(int command_id, 68 void ExecuteCommand(int command_id,
68 content::WebContents* web_contents, 69 content::WebContents* web_contents,
70 content::RenderFrameHost* render_frame_host,
69 const content::ContextMenuParams& params); 71 const content::ContextMenuParams& params);
70 72
71 private: 73 private:
72 friend class ::ExtensionContextMenuBrowserTest; 74 friend class ::ExtensionContextMenuBrowserTest;
73 75
74 bool GetRelevantExtensionTopLevelItems( 76 bool GetRelevantExtensionTopLevelItems(
75 const MenuItem::ExtensionKey& extension_key, 77 const MenuItem::ExtensionKey& extension_key,
76 const Extension** extension, 78 const Extension** extension,
77 bool* can_cross_incognito, 79 bool* can_cross_incognito,
78 MenuItem::List* items); 80 MenuItem::List* items);
(...skipping 27 matching lines...) Expand all
106 108
107 // Keep track of and clean up menu models for submenus. 109 // Keep track of and clean up menu models for submenus.
108 std::vector<scoped_ptr<ui::SimpleMenuModel>> extension_menu_models_; 110 std::vector<scoped_ptr<ui::SimpleMenuModel>> extension_menu_models_;
109 111
110 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher); 112 DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher);
111 }; 113 };
112 114
113 } // namespace extensions 115 } // namespace extensions
114 116
115 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_ 117 #endif // CHROME_BROWSER_EXTENSIONS_CONTEXT_MENU_MATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698