| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 } | 846 } |
| 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 | |
| 857 // Remove any redundant trailing separator. | |
| 858 if (menu_model_.GetItemCount() > 0 && | |
| 859 menu_model_.GetTypeAt(menu_model_.GetItemCount() - 1) == | |
| 860 ui::MenuModel::TYPE_SEPARATOR) { | |
| 861 menu_model_.RemoveItemAt(menu_model_.GetItemCount() - 1); | |
| 862 } | 856 } |
| 863 } | 857 } |
| 864 | 858 |
| 865 Profile* RenderViewContextMenu::GetProfile() { | 859 Profile* RenderViewContextMenu::GetProfile() { |
| 866 return Profile::FromBrowserContext(browser_context_); | 860 return Profile::FromBrowserContext(browser_context_); |
| 867 } | 861 } |
| 868 | 862 |
| 869 void RenderViewContextMenu::RecordUsedItem(int id) { | 863 void RenderViewContextMenu::RecordUsedItem(int id) { |
| 870 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); | 864 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); |
| 871 if (enum_id != -1) { | 865 if (enum_id != -1) { |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 void RenderViewContextMenu::PluginActionAt( | 2524 void RenderViewContextMenu::PluginActionAt( |
| 2531 const gfx::Point& location, | 2525 const gfx::Point& location, |
| 2532 const WebPluginAction& action) { | 2526 const WebPluginAction& action) { |
| 2533 source_web_contents_->GetRenderViewHost()-> | 2527 source_web_contents_->GetRenderViewHost()-> |
| 2534 ExecutePluginActionAtLocation(location, action); | 2528 ExecutePluginActionAtLocation(location, action); |
| 2535 } | 2529 } |
| 2536 | 2530 |
| 2537 Browser* RenderViewContextMenu::GetBrowser() const { | 2531 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2538 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2532 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2539 } | 2533 } |
| OLD | NEW |