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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 7258009: Remove scheme restriction for extension context menu items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing last nit Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" 8 #include "chrome/browser/tab_contents/render_view_context_menu.h"
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 menu_model_.SetIcon(index, icon); 435 menu_model_.SetIcon(index, icon);
436 } 436 }
437 437
438 void RenderViewContextMenu::AppendAllExtensionItems() { 438 void RenderViewContextMenu::AppendAllExtensionItems() {
439 extension_item_map_.clear(); 439 extension_item_map_.clear();
440 ExtensionService* service = profile_->GetExtensionService(); 440 ExtensionService* service = profile_->GetExtensionService();
441 if (!service) 441 if (!service)
442 return; // In unit-tests, we may not have an ExtensionService. 442 return; // In unit-tests, we may not have an ExtensionService.
443 ExtensionMenuManager* menu_manager = service->menu_manager(); 443 ExtensionMenuManager* menu_manager = service->menu_manager();
444 const GURL& document_url = GetDocumentURL(params_);
445 if (!menu_manager->HasAllowedScheme(document_url))
446 return;
447 444
448 // Get a list of extension id's that have context menu items, and sort it by 445 // Get a list of extension id's that have context menu items, and sort it by
449 // the extension's name. 446 // the extension's name.
450 std::set<std::string> ids = menu_manager->ExtensionIds(); 447 std::set<std::string> ids = menu_manager->ExtensionIds();
451 std::vector<std::pair<std::string, std::string> > sorted_ids; 448 std::vector<std::pair<std::string, std::string> > sorted_ids;
452 for (std::set<std::string>::iterator i = ids.begin(); i != ids.end(); ++i) { 449 for (std::set<std::string>::iterator i = ids.begin(); i != ids.end(); ++i) {
453 const Extension* extension = service->GetExtensionById(*i, false); 450 const Extension* extension = service->GetExtensionById(*i, false);
454 if (extension) 451 if (extension)
455 sorted_ids.push_back( 452 sorted_ids.push_back(
456 std::pair<std::string, std::string>(extension->name(), *i)); 453 std::pair<std::string, std::string>(extension->name(), *i));
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 g_browser_process->clipboard()); 1750 g_browser_process->clipboard());
1754 } 1751 }
1755 1752
1756 void RenderViewContextMenu::MediaPlayerActionAt( 1753 void RenderViewContextMenu::MediaPlayerActionAt(
1757 const gfx::Point& location, 1754 const gfx::Point& location,
1758 const WebMediaPlayerAction& action) { 1755 const WebMediaPlayerAction& action) {
1759 RenderViewHost* rvh = source_tab_contents_->render_view_host(); 1756 RenderViewHost* rvh = source_tab_contents_->render_view_host();
1760 rvh->Send(new ViewMsg_MediaPlayerActionAt( 1757 rvh->Send(new ViewMsg_MediaPlayerActionAt(
1761 rvh->routing_id(), location, action)); 1758 rvh->routing_id(), location, action));
1762 } 1759 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_menu_manager.cc ('k') | chrome/common/extensions/docs/contextMenus.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698