OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 334 } |
335 set_content_type(ContextMenuContentTypeFactory::Create( | 335 set_content_type(ContextMenuContentTypeFactory::Create( |
336 source_web_contents_, params)); | 336 source_web_contents_, params)); |
337 } | 337 } |
338 | 338 |
339 RenderViewContextMenu::~RenderViewContextMenu() { | 339 RenderViewContextMenu::~RenderViewContextMenu() { |
340 } | 340 } |
341 | 341 |
342 // Menu construction functions ------------------------------------------------- | 342 // Menu construction functions ------------------------------------------------- |
343 | 343 |
| 344 #if defined(ENABLE_EXTENSIONS) |
344 // static | 345 // static |
345 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( | 346 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( |
346 const content::ContextMenuParams& params, | 347 const content::ContextMenuParams& params, |
347 const MenuItem::ContextList& contexts, | 348 const MenuItem::ContextList& contexts, |
348 const extensions::URLPatternSet& target_url_patterns) { | 349 const extensions::URLPatternSet& target_url_patterns) { |
349 const bool has_link = !params.link_url.is_empty(); | 350 const bool has_link = !params.link_url.is_empty(); |
350 const bool has_selection = !params.selection_text.empty(); | 351 const bool has_selection = !params.selection_text.empty(); |
351 const bool in_frame = !params.frame_url.is_empty(); | 352 const bool in_frame = !params.frame_url.is_empty(); |
352 | 353 |
353 if (contexts.Contains(MenuItem::ALL) || | 354 if (contexts.Contains(MenuItem::ALL) || |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 int index = 0; | 468 int index = 0; |
468 const MenuItem::ExtensionKey key( | 469 const MenuItem::ExtensionKey key( |
469 extension->id(), | 470 extension->id(), |
470 extensions::WebViewGuest::GetViewInstanceId(source_web_contents_)); | 471 extensions::WebViewGuest::GetViewInstanceId(source_web_contents_)); |
471 extension_items_.AppendExtensionItems(key, | 472 extension_items_.AppendExtensionItems(key, |
472 PrintableSelectionText(), | 473 PrintableSelectionText(), |
473 &index, | 474 &index, |
474 false); // is_action_menu | 475 false); // is_action_menu |
475 } | 476 } |
476 } | 477 } |
| 478 #endif // defined(ENABLE_EXTENSIONS) |
477 | 479 |
478 void RenderViewContextMenu::InitMenu() { | 480 void RenderViewContextMenu::InitMenu() { |
479 RenderViewContextMenuBase::InitMenu(); | 481 RenderViewContextMenuBase::InitMenu(); |
480 | 482 |
481 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PAGE)) | 483 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PAGE)) |
482 AppendPageItems(); | 484 AppendPageItems(); |
483 | 485 |
484 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_FRAME)) { | 486 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_FRAME)) { |
485 // Merge in frame items with page items if we clicked within a frame that | 487 // Merge in frame items with page items if we clicked within a frame that |
486 // needs them. | 488 // needs them. |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 source_web_contents_->GetRenderViewHost()-> | 1792 source_web_contents_->GetRenderViewHost()-> |
1791 ExecuteMediaPlayerActionAtLocation(location, action); | 1793 ExecuteMediaPlayerActionAtLocation(location, action); |
1792 } | 1794 } |
1793 | 1795 |
1794 void RenderViewContextMenu::PluginActionAt( | 1796 void RenderViewContextMenu::PluginActionAt( |
1795 const gfx::Point& location, | 1797 const gfx::Point& location, |
1796 const WebPluginAction& action) { | 1798 const WebPluginAction& action) { |
1797 source_web_contents_->GetRenderViewHost()-> | 1799 source_web_contents_->GetRenderViewHost()-> |
1798 ExecutePluginActionAtLocation(location, action); | 1800 ExecutePluginActionAtLocation(location, action); |
1799 } | 1801 } |
OLD | NEW |