Commit db55a927 authored by Alexandre Frechette's avatar Alexandre Frechette Committed by Commit Bot

Log a UMA for BLOCK_CONTENT action.

Bug: 1044196
Change-Id: I234d75dc1de8f7d4ccb964435442db567d0df93a
TBR: twellington@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199479
Commit-Queue: Alexandre Frechette <frechette@chromium.org>
Reviewed-by: default avatarDan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768497}
parent 4e0108ad
...@@ -362,6 +362,7 @@ public class FeedLoggingBridge implements BasicLoggingApi { ...@@ -362,6 +362,7 @@ public class FeedLoggingBridge implements BasicLoggingApi {
return WindowOpenDisposition.SAVE_TO_DISK; return WindowOpenDisposition.SAVE_TO_DISK;
case ActionType.LEARN_MORE: case ActionType.LEARN_MORE:
case ActionType.MANAGE_INTERESTS: case ActionType.MANAGE_INTERESTS:
case ActionType.BLOCK_CONTENT:
case ActionType.UNKNOWN: case ActionType.UNKNOWN:
default: default:
return WindowOpenDisposition.UNKNOWN; return WindowOpenDisposition.UNKNOWN;
...@@ -370,6 +371,9 @@ public class FeedLoggingBridge implements BasicLoggingApi { ...@@ -370,6 +371,9 @@ public class FeedLoggingBridge implements BasicLoggingApi {
private void recordUserAction(@ActionType int actionType) { private void recordUserAction(@ActionType int actionType) {
switch (actionType) { switch (actionType) {
case ActionType.BLOCK_CONTENT:
NewTabPageUma.recordAction(NewTabPageUma.ACTION_BLOCK_CONTENT);
break;
case ActionType.OPEN_URL: case ActionType.OPEN_URL:
case ActionType.OPEN_URL_INCOGNITO: case ActionType.OPEN_URL_INCOGNITO:
case ActionType.OPEN_URL_NEW_TAB: case ActionType.OPEN_URL_NEW_TAB:
......
...@@ -15,7 +15,8 @@ import androidx.annotation.IntDef; ...@@ -15,7 +15,8 @@ import androidx.annotation.IntDef;
*/ */
@IntDef({ActionType.UNKNOWN, ActionType.OPEN_URL, ActionType.OPEN_URL_INCOGNITO, @IntDef({ActionType.UNKNOWN, ActionType.OPEN_URL, ActionType.OPEN_URL_INCOGNITO,
ActionType.OPEN_URL_NEW_TAB, ActionType.OPEN_URL_NEW_WINDOW, ActionType.DOWNLOAD, ActionType.OPEN_URL_NEW_TAB, ActionType.OPEN_URL_NEW_WINDOW, ActionType.DOWNLOAD,
ActionType.LEARN_MORE, ActionType.MANAGE_INTERESTS, ActionType.NEXT_VALUE}) ActionType.LEARN_MORE, ActionType.MANAGE_INTERESTS, ActionType.BLOCK_CONTENT,
ActionType.NEXT_VALUE})
// LINT.IfChange // LINT.IfChange
public @interface ActionType { public @interface ActionType {
int UNKNOWN = -1; int UNKNOWN = -1;
...@@ -26,6 +27,7 @@ public @interface ActionType { ...@@ -26,6 +27,7 @@ public @interface ActionType {
int DOWNLOAD = 5; int DOWNLOAD = 5;
int LEARN_MORE = 6; int LEARN_MORE = 6;
int MANAGE_INTERESTS = 7; int MANAGE_INTERESTS = 7;
int NEXT_VALUE = 8; int BLOCK_CONTENT = 8;
int NEXT_VALUE = 9;
} }
// LINT.ThenChange // LINT.ThenChange
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.feed.library.feedactionparser; package org.chromium.chrome.browser.feed.library.feedactionparser;
import static org.chromium.chrome.browser.feed.library.common.Validators.checkState; import static org.chromium.chrome.browser.feed.library.common.Validators.checkState;
import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.BLOCK_CONTENT;
import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.DOWNLOAD; import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.DOWNLOAD;
import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.LEARN_MORE; import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.LEARN_MORE;
import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.MANAGE_INTERESTS; import static org.chromium.components.feed.core.proto.ui.action.FeedActionProto.FeedActionMetadata.Type.MANAGE_INTERESTS;
...@@ -205,6 +206,7 @@ public final class FeedActionParser implements ActionParser { ...@@ -205,6 +206,7 @@ public final class FeedActionParser implements ActionParser {
mProtocolAdapter.createOperations( mProtocolAdapter.createOperations(
feedActionMetadata.getBlockContentData().getDataOperationsList()), feedActionMetadata.getBlockContentData().getDataOperationsList()),
feedActionMetadata.getBlockContentData().getPayload()); feedActionMetadata.getBlockContentData().getPayload());
streamActionApi.onClientAction(ActionTypesConverter.convert(BLOCK_CONTENT));
break; break;
case REPORT_VIEW: case REPORT_VIEW:
ViewReportData viewReportData = feedActionMetadata.getViewReportData(); ViewReportData viewReportData = feedActionMetadata.getViewReportData();
......
...@@ -29,6 +29,8 @@ public final class ActionTypesConverter { ...@@ -29,6 +29,8 @@ public final class ActionTypesConverter {
return ActionType.LEARN_MORE; return ActionType.LEARN_MORE;
case MANAGE_INTERESTS: case MANAGE_INTERESTS:
return ActionType.MANAGE_INTERESTS; return ActionType.MANAGE_INTERESTS;
case BLOCK_CONTENT:
return ActionType.BLOCK_CONTENT;
default: default:
return ActionType.UNKNOWN; return ActionType.UNKNOWN;
} }
......
...@@ -847,6 +847,7 @@ public class FeedActionParserTest { ...@@ -847,6 +847,7 @@ public class FeedActionParserTest {
BLOCK_CONTENT_ACTION, mStreamActionApi, /* view= */ null, ActionSource.CLICK); BLOCK_CONTENT_ACTION, mStreamActionApi, /* view= */ null, ActionSource.CLICK);
verify(mStreamActionApi) verify(mStreamActionApi)
.handleBlockContent(mStreamDataOperations, ActionPayload.getDefaultInstance()); .handleBlockContent(mStreamDataOperations, ActionPayload.getDefaultInstance());
verify(mStreamActionApi).onClientAction(ActionType.BLOCK_CONTENT);
} }
@Test @Test
......
...@@ -77,8 +77,11 @@ public class NewTabPageUma { ...@@ -77,8 +77,11 @@ public class NewTabPageUma {
/** User clicked on the "Manage Interests" item in the snippet card menu. */ /** User clicked on the "Manage Interests" item in the snippet card menu. */
public static final int ACTION_CLICKED_MANAGE_INTERESTS = 12; public static final int ACTION_CLICKED_MANAGE_INTERESTS = 12;
/** User triggered a block content action. **/
public static final int ACTION_BLOCK_CONTENT = 13;
/** The number of possible actions. */ /** The number of possible actions. */
private static final int NUM_ACTIONS = 13; private static final int NUM_ACTIONS = 14;
/** Regular NTP impression (usually when a new tab is opened). */ /** Regular NTP impression (usually when a new tab is opened). */
public static final int NTP_IMPRESSION_REGULAR = 0; public static final int NTP_IMPRESSION_REGULAR = 0;
......
...@@ -48117,6 +48117,10 @@ Called by update_net_trust_anchors.py.--> ...@@ -48117,6 +48117,10 @@ Called by update_net_trust_anchors.py.-->
label="Clicked on the Refresh button in the all dismissed state"/> label="Clicked on the Refresh button in the all dismissed state"/>
<int value="11" label="Opened an explore sites tile"/> <int value="11" label="Opened an explore sites tile"/>
<int value="12" label="Opened the manage interests page from the feed"/> <int value="12" label="Opened the manage interests page from the feed"/>
<int value="13"
label="Triggered a block content action, which typically results in the
content being removed from the feed, and a setting written
server side to avoid serving that content again."/>
</enum> </enum>
<enum name="NewTabPageActioniOS"> <enum name="NewTabPageActioniOS">
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