OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
10 | 10 |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 651 |
652 return system->process_manager()->GetExtensionForRenderViewHost( | 652 return system->process_manager()->GetExtensionForRenderViewHost( |
653 source_web_contents_->GetRenderViewHost()); | 653 source_web_contents_->GetRenderViewHost()); |
654 } | 654 } |
655 | 655 |
656 void RenderViewContextMenu::AppendPlatformAppItems() { | 656 void RenderViewContextMenu::AppendPlatformAppItems() { |
657 const Extension* platform_app = GetExtension(); | 657 const Extension* platform_app = GetExtension(); |
658 DCHECK(platform_app); | 658 DCHECK(platform_app); |
659 DCHECK(platform_app->is_platform_app()); | 659 DCHECK(platform_app->is_platform_app()); |
660 | 660 |
| 661 bool has_selection = !params_.selection_text.empty(); |
| 662 |
| 663 // Add undo/redo, cut/copy/paste etc for text fields |
| 664 if (params_.is_editable) |
| 665 AppendEditableItems(); |
| 666 else if (has_selection) |
| 667 AppendCopyItem(); |
| 668 |
661 int index = 0; | 669 int index = 0; |
662 AppendExtensionItems(platform_app->id(), &index); | 670 AppendExtensionItems(platform_app->id(), &index); |
663 | 671 |
664 // Add dev tools for unpacked extensions. | 672 // Add dev tools for unpacked extensions. |
665 if (platform_app->location() == Extension::LOAD) { | 673 if (platform_app->location() == Extension::LOAD) { |
666 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); | 674 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); |
667 AppendDeveloperItems(); | 675 AppendDeveloperItems(); |
668 } | 676 } |
669 } | 677 } |
670 | 678 |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 source_web_contents_->GetRenderViewHost()-> | 2023 source_web_contents_->GetRenderViewHost()-> |
2016 ExecuteMediaPlayerActionAtLocation(location, action); | 2024 ExecuteMediaPlayerActionAtLocation(location, action); |
2017 } | 2025 } |
2018 | 2026 |
2019 void RenderViewContextMenu::PluginActionAt( | 2027 void RenderViewContextMenu::PluginActionAt( |
2020 const gfx::Point& location, | 2028 const gfx::Point& location, |
2021 const WebPluginAction& action) { | 2029 const WebPluginAction& action) { |
2022 source_web_contents_->GetRenderViewHost()-> | 2030 source_web_contents_->GetRenderViewHost()-> |
2023 ExecutePluginActionAtLocation(location, action); | 2031 ExecutePluginActionAtLocation(location, action); |
2024 } | 2032 } |
OLD | NEW |