OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 const GURL& document_url = GetDocumentURL(params); | 506 const GURL& document_url = GetDocumentURL(params); |
507 return ExtensionPatternMatch(item->document_url_patterns(), document_url); | 507 return ExtensionPatternMatch(item->document_url_patterns(), document_url); |
508 } | 508 } |
509 | 509 |
510 void RenderViewContextMenu::AppendAllExtensionItems() { | 510 void RenderViewContextMenu::AppendAllExtensionItems() { |
511 extension_items_.Clear(); | 511 extension_items_.Clear(); |
512 ExtensionService* service = | 512 ExtensionService* service = |
513 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 513 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
514 if (!service) | 514 if (!service) |
515 return; // In unit-tests, we may not have an ExtensionService. | 515 return; // In unit-tests, we may not have an ExtensionService. |
516 MenuManager* menu_manager = service->menu_manager(); | 516 |
| 517 MenuManager* menu_manager = MenuManager::Get(profile_); |
| 518 if (!menu_manager) |
| 519 return; |
517 | 520 |
518 string16 printable_selection_text = PrintableSelectionText(); | 521 string16 printable_selection_text = PrintableSelectionText(); |
519 EscapeAmpersands(&printable_selection_text); | 522 EscapeAmpersands(&printable_selection_text); |
520 | 523 |
521 // Get a list of extension id's that have context menu items, and sort by the | 524 // Get a list of extension id's that have context menu items, and sort by the |
522 // top level context menu title of the extension. | 525 // top level context menu title of the extension. |
523 std::set<std::string> ids = menu_manager->ExtensionIds(); | 526 std::set<std::string> ids = menu_manager->ExtensionIds(); |
524 std::vector<base::string16> sorted_menu_titles; | 527 std::vector<base::string16> sorted_menu_titles; |
525 std::map<base::string16, std::string> map_ids; | 528 std::map<base::string16, std::string> map_ids; |
526 for (std::set<std::string>::iterator i = ids.begin(); i != ids.end(); ++i) { | 529 for (std::set<std::string>::iterator i = ids.begin(); i != ids.end(); ++i) { |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 source_web_contents_->GetRenderViewHost()-> | 2112 source_web_contents_->GetRenderViewHost()-> |
2110 ExecuteMediaPlayerActionAtLocation(location, action); | 2113 ExecuteMediaPlayerActionAtLocation(location, action); |
2111 } | 2114 } |
2112 | 2115 |
2113 void RenderViewContextMenu::PluginActionAt( | 2116 void RenderViewContextMenu::PluginActionAt( |
2114 const gfx::Point& location, | 2117 const gfx::Point& location, |
2115 const WebPluginAction& action) { | 2118 const WebPluginAction& action) { |
2116 source_web_contents_->GetRenderViewHost()-> | 2119 source_web_contents_->GetRenderViewHost()-> |
2117 ExecutePluginActionAtLocation(location, action); | 2120 ExecutePluginActionAtLocation(location, action); |
2118 } | 2121 } |
OLD | NEW |