Commit c78637e0 authored by johnme's avatar johnme Committed by Commit bot

Fix incorrect IPC_ENUM_TRAITS_MAX_VALUE for NTPLoggingEventType

The comment for IPC_ENUM_TRAITS_MAX_VALUE says you should pass the largest
possible value, inclusive. But NTP_NUM_EVENT_TYPES is one larger than the
largest possible NTPLoggingEventType.

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

Cr-Commit-Position: refs/heads/master@{#300248}
parent 242b2265
......@@ -8,7 +8,7 @@
// The different types of events that are logged from the NTP. This enum is used
// to transfer information from the NTP javascript to the renderer and is not
// used as a UMA enum histogram's logged value.
// Note: Keep in sync with browser/resources/local_ntp/most_visited_utils.js
// Note: Keep in sync with browser/resources/local_ntp/most_visited_util.js
enum NTPLoggingEventType {
// The suggestion is coming from the server.
NTP_SERVER_SIDE_SUGGESTION = 0,
......@@ -43,7 +43,7 @@ enum NTPLoggingEventType {
// The user moused over an NTP tile or title.
NTP_MOUSEOVER = 9,
NTP_NUM_EVENT_TYPES
NTP_EVENT_TYPE_LAST = NTP_MOUSEOVER
};
#endif // CHROME_COMMON_NTP_LOGGING_EVENTS_H_
......@@ -188,7 +188,7 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebCache::UsageStats)
IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS_MAX_VALUE(NTPLoggingEventType,
NTP_NUM_EVENT_TYPES)
NTP_EVENT_TYPE_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(WebApplicationInfo::MobileCapable,
WebApplicationInfo::MOBILE_CAPABLE_APPLE)
......
......@@ -971,7 +971,7 @@ void SearchBoxExtensionWrapper::LogEvent(
DVLOG(1) << render_view << " LogEvent";
if (args[0]->Uint32Value() < NTP_NUM_EVENT_TYPES) {
if (args[0]->Uint32Value() <= NTP_EVENT_TYPE_LAST) {
NTPLoggingEventType event =
static_cast<NTPLoggingEventType>(args[0]->Uint32Value());
SearchBox::Get(render_view)->LogEvent(event);
......
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