| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 | 847 |
| 848 if (content_type_->SupportsGroup( | 848 if (content_type_->SupportsGroup( |
| 849 ContextMenuContentType::ITEM_GROUP_PRINT_PREVIEW)) { | 849 ContextMenuContentType::ITEM_GROUP_PRINT_PREVIEW)) { |
| 850 AppendPrintPreviewItems(); | 850 AppendPrintPreviewItems(); |
| 851 } | 851 } |
| 852 | 852 |
| 853 if (content_type_->SupportsGroup( | 853 if (content_type_->SupportsGroup( |
| 854 ContextMenuContentType::ITEM_GROUP_PASSWORD)) { | 854 ContextMenuContentType::ITEM_GROUP_PASSWORD)) { |
| 855 AppendPasswordItems(); | 855 AppendPasswordItems(); |
| 856 } | 856 } |
| 857 |
| 858 // Remove any redundant trailing separator. |
| 859 if (menu_model_.GetItemCount() > 0 && |
| 860 menu_model_.GetTypeAt(menu_model_.GetItemCount() - 1) == |
| 861 ui::MenuModel::TYPE_SEPARATOR) { |
| 862 menu_model_.RemoveItemAt(menu_model_.GetItemCount() - 1); |
| 863 } |
| 857 } | 864 } |
| 858 | 865 |
| 859 Profile* RenderViewContextMenu::GetProfile() { | 866 Profile* RenderViewContextMenu::GetProfile() { |
| 860 return Profile::FromBrowserContext(browser_context_); | 867 return Profile::FromBrowserContext(browser_context_); |
| 861 } | 868 } |
| 862 | 869 |
| 863 void RenderViewContextMenu::RecordUsedItem(int id) { | 870 void RenderViewContextMenu::RecordUsedItem(int id) { |
| 864 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); | 871 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); |
| 865 if (enum_id != -1) { | 872 if (enum_id != -1) { |
| 866 const size_t kMappingSize = arraysize(kUmaEnumToControlId); | 873 const size_t kMappingSize = arraysize(kUmaEnumToControlId); |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 void RenderViewContextMenu::PluginActionAt( | 2531 void RenderViewContextMenu::PluginActionAt( |
| 2525 const gfx::Point& location, | 2532 const gfx::Point& location, |
| 2526 const WebPluginAction& action) { | 2533 const WebPluginAction& action) { |
| 2527 source_web_contents_->GetRenderViewHost()-> | 2534 source_web_contents_->GetRenderViewHost()-> |
| 2528 ExecutePluginActionAtLocation(location, action); | 2535 ExecutePluginActionAtLocation(location, action); |
| 2529 } | 2536 } |
| 2530 | 2537 |
| 2531 Browser* RenderViewContextMenu::GetBrowser() const { | 2538 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2532 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2539 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2533 } | 2540 } |
| OLD | NEW |