Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3124)

Unified Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 2117373002: Cleanup: Change LogMostVisitedImpression|Navigation APIs to take an enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ntp_uma_cleanup
Patch Set: TODO Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/searchbox/searchbox_extension.cc
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index e2aa8ab777589f1b1d22aa9510ddebf8136be31c..6f307f6276b5e63ecaa6cb2bee0d32361494e325 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -1060,15 +1060,19 @@ void SearchBoxExtensionWrapper::LogMostVisitedImpression(
GURL(chrome::kChromeSearchMostVisitedUrl));
if (!render_view) return;
- if (args.Length() < 2 || !args[0]->IsNumber() || args[1]->IsUndefined()) {
+ if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
ThrowInvalidParameters(args);
return;
}
DVLOG(1) << render_view << " LogMostVisitedImpression";
- SearchBox::Get(render_view)->LogMostVisitedImpression(
- args[0]->IntegerValue(), V8ValueToUTF16(args[1]));
+ if (args[1]->Uint32Value() <= NTP_TILE_SOURCE_LAST) {
dcheng 2016/07/06 01:51:25 Nit: I have a weak preference for making this a DC
Marc Treib 2016/07/06 08:49:07 But the same would apply for all the other validit
Marc Treib 2016/07/06 08:55:56 Hm, then again, looking at the code around, nothin
dcheng 2016/07/06 09:01:28 Shrug, if it's copy and pasted, I guess that's fin
+ NTPLoggingTileSource tile_source =
+ static_cast<NTPLoggingTileSource>(args[1]->Uint32Value());
+ SearchBox::Get(render_view)->LogMostVisitedImpression(
+ args[0]->IntegerValue(), tile_source);
+ }
}
// static
@@ -1078,15 +1082,19 @@ void SearchBoxExtensionWrapper::LogMostVisitedNavigation(
GURL(chrome::kChromeSearchMostVisitedUrl));
if (!render_view) return;
- if (args.Length() < 2 || !args[0]->IsNumber() || args[1]->IsUndefined()) {
+ if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
ThrowInvalidParameters(args);
return;
}
DVLOG(1) << render_view << " LogMostVisitedNavigation";
- SearchBox::Get(render_view)->LogMostVisitedNavigation(
- args[0]->IntegerValue(), V8ValueToUTF16(args[1]));
+ if (args[1]->Uint32Value() <= NTP_TILE_SOURCE_LAST) {
+ NTPLoggingTileSource tile_source =
+ static_cast<NTPLoggingTileSource>(args[1]->Uint32Value());
+ SearchBox::Get(render_view)->LogMostVisitedNavigation(
+ args[0]->IntegerValue(), tile_source);
+ }
}
// static
« chrome/common/ntp_logging_events.h ('K') | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698