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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 } | 848 } |
849 | 849 |
850 Profile* RenderViewContextMenu::GetProfile() { | 850 Profile* RenderViewContextMenu::GetProfile() { |
851 return Profile::FromBrowserContext(browser_context_); | 851 return Profile::FromBrowserContext(browser_context_); |
852 } | 852 } |
853 | 853 |
854 void RenderViewContextMenu::RecordUsedItem(int id) { | 854 void RenderViewContextMenu::RecordUsedItem(int id) { |
855 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); | 855 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); |
856 if (enum_id != -1) { | 856 if (enum_id != -1) { |
857 const size_t kMappingSize = arraysize(kUmaEnumToControlId); | 857 const size_t kMappingSize = arraysize(kUmaEnumToControlId); |
858 UMA_HISTOGRAM_ENUMERATION("RenderViewContextMenu.Used", enum_id, | 858 UMA_HISTOGRAM_EXACT_LINEAR("RenderViewContextMenu.Used", enum_id, |
859 kUmaEnumToControlId[kMappingSize - 1].enum_id); | 859 kUmaEnumToControlId[kMappingSize - 1].enum_id); |
860 // Record to additional context specific histograms. | 860 // Record to additional context specific histograms. |
861 enum_id = FindUMAEnumValueForCommand(id, CONTEXT_SPECIFIC_ENUM_ID); | 861 enum_id = FindUMAEnumValueForCommand(id, CONTEXT_SPECIFIC_ENUM_ID); |
862 | 862 |
863 // Linked image context. | 863 // Linked image context. |
864 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_LINK) && | 864 if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_LINK) && |
865 content_type_->SupportsGroup( | 865 content_type_->SupportsGroup( |
866 ContextMenuContentType::ITEM_GROUP_MEDIA_IMAGE)) { | 866 ContextMenuContentType::ITEM_GROUP_MEDIA_IMAGE)) { |
867 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.ImageLink", enum_id, | 867 UMA_HISTOGRAM_EXACT_LINEAR("ContextMenu.SelectedOption.ImageLink", |
868 kUmaEnumToControlId[kMappingSize - 1].enum_id); | 868 enum_id, |
| 869 kUmaEnumToControlId[kMappingSize - 1].enum_id); |
869 } | 870 } |
870 // Selected text context. | 871 // Selected text context. |
871 if (content_type_->SupportsGroup( | 872 if (content_type_->SupportsGroup( |
872 ContextMenuContentType::ITEM_GROUP_SEARCH_PROVIDER) && | 873 ContextMenuContentType::ITEM_GROUP_SEARCH_PROVIDER) && |
873 content_type_->SupportsGroup( | 874 content_type_->SupportsGroup( |
874 ContextMenuContentType::ITEM_GROUP_PRINT)) { | 875 ContextMenuContentType::ITEM_GROUP_PRINT)) { |
875 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.SelectedText", | 876 UMA_HISTOGRAM_EXACT_LINEAR("ContextMenu.SelectedOption.SelectedText", |
876 enum_id, | 877 enum_id, |
877 kUmaEnumToControlId[kMappingSize - 1].enum_id); | 878 kUmaEnumToControlId[kMappingSize - 1].enum_id); |
878 } | 879 } |
879 // Misspelled word context. | 880 // Misspelled word context. |
880 if (!params_.misspelled_word.empty()) { | 881 if (!params_.misspelled_word.empty()) { |
881 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.MisspelledWord", | 882 UMA_HISTOGRAM_EXACT_LINEAR("ContextMenu.SelectedOption.MisspelledWord", |
882 enum_id, | 883 enum_id, |
883 kUmaEnumToControlId[kMappingSize - 1].enum_id); | 884 kUmaEnumToControlId[kMappingSize - 1].enum_id); |
884 } | 885 } |
885 } else { | 886 } else { |
886 NOTREACHED() << "Update kUmaEnumToControlId. Unhanded IDC: " << id; | 887 NOTREACHED() << "Update kUmaEnumToControlId. Unhanded IDC: " << id; |
887 } | 888 } |
888 } | 889 } |
889 | 890 |
890 void RenderViewContextMenu::RecordShownItem(int id) { | 891 void RenderViewContextMenu::RecordShownItem(int id) { |
891 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); | 892 int enum_id = FindUMAEnumValueForCommand(id, GENERAL_ENUM_ID); |
892 if (enum_id != -1) { | 893 if (enum_id != -1) { |
893 const size_t kMappingSize = arraysize(kUmaEnumToControlId); | 894 const size_t kMappingSize = arraysize(kUmaEnumToControlId); |
894 UMA_HISTOGRAM_ENUMERATION("RenderViewContextMenu.Shown", enum_id, | 895 UMA_HISTOGRAM_EXACT_LINEAR("RenderViewContextMenu.Shown", enum_id, |
895 kUmaEnumToControlId[kMappingSize - 1].enum_id); | 896 kUmaEnumToControlId[kMappingSize - 1].enum_id); |
896 } else { | 897 } else { |
897 // Just warning here. It's harder to maintain list of all possibly | 898 // Just warning here. It's harder to maintain list of all possibly |
898 // visible items than executable items. | 899 // visible items than executable items. |
899 DLOG(ERROR) << "Update kUmaEnumToControlId. Unhanded IDC: " << id; | 900 DLOG(ERROR) << "Update kUmaEnumToControlId. Unhanded IDC: " << id; |
900 } | 901 } |
901 } | 902 } |
902 | 903 |
903 bool RenderViewContextMenu::IsHTML5Fullscreen() const { | 904 bool RenderViewContextMenu::IsHTML5Fullscreen() const { |
904 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_); | 905 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_); |
905 if (!browser) | 906 if (!browser) |
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 void RenderViewContextMenu::PluginActionAt( | 2505 void RenderViewContextMenu::PluginActionAt( |
2505 const gfx::Point& location, | 2506 const gfx::Point& location, |
2506 const WebPluginAction& action) { | 2507 const WebPluginAction& action) { |
2507 source_web_contents_->GetRenderViewHost()-> | 2508 source_web_contents_->GetRenderViewHost()-> |
2508 ExecutePluginActionAtLocation(location, action); | 2509 ExecutePluginActionAtLocation(location, action); |
2509 } | 2510 } |
2510 | 2511 |
2511 Browser* RenderViewContextMenu::GetBrowser() const { | 2512 Browser* RenderViewContextMenu::GetBrowser() const { |
2512 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2513 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
2513 } | 2514 } |
OLD | NEW |