Record RenderViewContextMenu.Used histogram for commands handled by observers.

Added UMA constant for counting IDC_SPELLCHECK_SUGGESTION_*.

TBR=asvitkine
BUG=378933

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=273817

Review URL: https://codereview.chromium.org/306103002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274161 0039d316-1c4b-4281-b951-d872f2087c98
parent c0083e9c
......@@ -205,8 +205,9 @@ const struct UmaEnumCommandIdPair {
{ 55, IDC_CONTENT_CONTEXT_SPELLING_TOGGLE },
{ 56, IDC_SPELLCHECK_LANGUAGES_FIRST },
{ 57, IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE },
{ 58, IDC_SPELLCHECK_SUGGESTION_0 },
// Add new items here and use |enum_id| from the next line.
{ 58, 0 }, // Must be the last. Increment |enum_id| when new IDC was added.
{ 59, 0 }, // Must be the last. Increment |enum_id| when new IDC was added.
};
// Collapses large ranges of ids before looking for UMA enum.
......@@ -231,6 +232,11 @@ int CollapleCommandsForUMA(int id) {
return IDC_SPELLCHECK_LANGUAGES_FIRST;
}
if (id >= IDC_SPELLCHECK_SUGGESTION_0 &&
id <= IDC_SPELLCHECK_SUGGESTION_LAST) {
return IDC_SPELLCHECK_SUGGESTION_0;
}
return id;
}
......@@ -1416,6 +1422,8 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
command_executed_ = true;
RecordUsedItem(id);
// If this command is is added by one of our observers, we dispatch it to the
// observer.
ObserverListBase<RenderViewContextMenuObserver>::Iterator it(observers_);
......@@ -1425,8 +1433,6 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
return observer->ExecuteCommand(id);
}
RecordUsedItem(id);
RenderFrameHost* render_frame_host =
RenderFrameHost::FromID(render_process_id_, render_frame_id_);
......
......@@ -41742,6 +41742,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="55" label="IDC_CONTENT_CONTEXT_SPELLING_TOGGLE"/>
<int value="56" label="IDC_SPELLCHECK_LANGUAGES_FIRST"/>
<int value="57" label="IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE"/>
<int value="58" label="IDC_SPELLCHECK_SUGGESTION"/>
</enum>
<enum name="ResolutionCategory" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment