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

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

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 #include "chrome/browser/extensions/context_menu_matcher.h" 5 #include "chrome/browser/extensions/context_menu_matcher.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/extensions/extension_util.h" 9 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/common/extensions/api/context_menus.h" 10 #include "chrome/common/extensions/api/context_menus.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return item->checked(); 159 return item->checked();
160 } 160 }
161 161
162 bool ContextMenuMatcher::IsCommandIdEnabled(int command_id) const { 162 bool ContextMenuMatcher::IsCommandIdEnabled(int command_id) const {
163 MenuItem* item = GetExtensionMenuItem(command_id); 163 MenuItem* item = GetExtensionMenuItem(command_id);
164 if (!item) 164 if (!item)
165 return true; 165 return true;
166 return item->enabled(); 166 return item->enabled();
167 } 167 }
168 168
169 void ContextMenuMatcher::ExecuteCommand(int command_id, 169 void ContextMenuMatcher::ExecuteCommand(
170 int command_id,
170 content::WebContents* web_contents, 171 content::WebContents* web_contents,
172 content::RenderFrameHost* render_frame_host,
171 const content::ContextMenuParams& params) { 173 const content::ContextMenuParams& params) {
172 MenuItem* item = GetExtensionMenuItem(command_id); 174 MenuItem* item = GetExtensionMenuItem(command_id);
173 if (!item) 175 if (!item)
174 return; 176 return;
175 177
176 MenuManager* manager = MenuManager::Get(browser_context_); 178 MenuManager* manager = MenuManager::Get(browser_context_);
177 manager->ExecuteCommand(browser_context_, web_contents, params, item->id()); 179 manager->ExecuteCommand(browser_context_, web_contents, render_frame_host,
180 params, item->id());
178 } 181 }
179 182
180 bool ContextMenuMatcher::GetRelevantExtensionTopLevelItems( 183 bool ContextMenuMatcher::GetRelevantExtensionTopLevelItems(
181 const MenuItem::ExtensionKey& extension_key, 184 const MenuItem::ExtensionKey& extension_key,
182 const Extension** extension, 185 const Extension** extension,
183 bool* can_cross_incognito, 186 bool* can_cross_incognito,
184 MenuItem::List* items) { 187 MenuItem::List* items) {
185 *extension = ExtensionRegistry::Get( 188 *extension = ExtensionRegistry::Get(
186 browser_context_)->enabled_extensions().GetByID( 189 browser_context_)->enabled_extensions().GetByID(
187 extension_key.extension_id); 190 extension_key.extension_id);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 DCHECK_GE(index, 0); 310 DCHECK_GE(index, 0);
308 311
309 const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id); 312 const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id);
310 DCHECK(icon.width() == gfx::kFaviconSize); 313 DCHECK(icon.width() == gfx::kFaviconSize);
311 DCHECK(icon.height() == gfx::kFaviconSize); 314 DCHECK(icon.height() == gfx::kFaviconSize);
312 315
313 menu_model_->SetIcon(index, gfx::Image::CreateFrom1xBitmap(icon)); 316 menu_model_->SetIcon(index, gfx::Image::CreateFrom1xBitmap(icon));
314 } 317 }
315 318
316 } // namespace extensions 319 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698