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

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

Issue 2796643002: NTP: Record TileType metrics also on desktop (Closed)
Patch Set: review Created 3 years, 8 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 c2134402bcf620617c53fe502aac6b83f4e9e1a8..d22db0369a4860b26692f9f54a60e96a2d939664 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -23,6 +23,7 @@
#include "chrome/renderer/searchbox/searchbox.h"
#include "components/crx_file/id_util.h"
#include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -994,18 +995,23 @@ void SearchBoxExtensionWrapper::LogMostVisitedImpression(
if (!render_frame)
return;
- if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
+ if (args.Length() < 3 || !args[0]->IsNumber() || !args[1]->IsNumber() ||
+ !args[2]->IsNumber()) {
ThrowInvalidParameters(args);
return;
}
DVLOG(1) << render_frame << " LogMostVisitedImpression";
- if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST)) {
- ntp_tiles::TileSource tile_source =
+ if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST) &&
+ args[2]->Uint32Value() <= ntp_tiles::TileVisualType::TILE_TYPE_MAX) {
+ auto tile_source =
static_cast<ntp_tiles::TileSource>(args[1]->Uint32Value());
+ auto tile_type =
+ static_cast<ntp_tiles::TileVisualType>(args[2]->Uint32Value());
SearchBox::Get(render_frame)
- ->LogMostVisitedImpression(args[0]->IntegerValue(), tile_source);
+ ->LogMostVisitedImpression(args[0]->IntegerValue(), tile_source,
+ tile_type);
}
}
@@ -1024,11 +1030,15 @@ void SearchBoxExtensionWrapper::LogMostVisitedNavigation(
DVLOG(1) << render_frame << " LogMostVisitedNavigation";
- if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST)) {
- ntp_tiles::TileSource tile_source =
+ if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST) &&
+ args[2]->Uint32Value() <= ntp_tiles::TileVisualType::TILE_TYPE_MAX) {
+ auto tile_source =
static_cast<ntp_tiles::TileSource>(args[1]->Uint32Value());
+ auto tile_type =
+ static_cast<ntp_tiles::TileVisualType>(args[2]->Uint32Value());
SearchBox::Get(render_frame)
- ->LogMostVisitedNavigation(args[0]->IntegerValue(), tile_source);
+ ->LogMostVisitedNavigation(args[0]->IntegerValue(), tile_source,
+ tile_type);
}
}

Powered by Google App Engine
This is Rietveld 408576698