Skip to content

Commit

Permalink
Fix incorrect IPC_ENUM_TRAITS_MAX_VALUE for NTPLoggingEventType
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
johnmellor authored and Commit bot committed Oct 20, 2014
1 parent 242b226 commit c78637e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chrome/common/ntp_logging_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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_
2 changes: 1 addition & 1 deletion chrome/common/render_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/searchbox/searchbox_extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c78637e

Please sign in to comment.