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

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

Issue 17526008: Log NTP hovers in 1993 clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed OVERRIDE error Created 7 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 03536bb493434164694e04acb3e19f48290be544..4b364de98ec31ef6951ad6407a5eefab35f87932 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -651,6 +651,9 @@ class SearchBoxExtensionWrapper : public v8::Extension {
static void GetMostVisitedItemData(
const v8::FunctionCallbackInfo<v8::Value>& args);
+ // Logs information from the iframes/titles on the NTP.
+ static void LogEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
+
// Gets whether the omnibox has focus or not.
static void IsFocused(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -745,6 +748,8 @@ v8::Handle<v8::FunctionTemplate> SearchBoxExtensionWrapper::GetNativeFunction(
return v8::FunctionTemplate::New(GetSuggestionData);
if (name->Equals(v8::String::New("GetMostVisitedItemData")))
return v8::FunctionTemplate::New(GetMostVisitedItemData);
+ if (name->Equals(v8::String::New("LogEvent")))
+ return v8::FunctionTemplate::New(LogEvent);
if (name->Equals(v8::String::New("IsFocused")))
return v8::FunctionTemplate::New(IsFocused);
if (name->Equals(v8::String::New("IsInputInProgress")))
@@ -1474,6 +1479,26 @@ void SearchBoxExtensionWrapper::GetMostVisitedItemData(
}
// static
+void SearchBoxExtensionWrapper::LogEvent(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ content::RenderView* render_view = GetRenderViewWithCheckedOrigin(
+ GURL(chrome::kChromeSearchMostVisitedUrl));
+ if (!render_view) return;
+
+ if (args.Length() < 1 || !args[0]->IsString())
+ return;
+
+ DVLOG(1) << render_view << " LogEvent";
+
+ std::string histogram_name = *v8::String::Utf8Value(args[0]->ToString());
+
+ if (histogram_name == "NewTabPage.NumberOfMouseOvers")
+ SearchBox::Get(render_view)->CountMouseover();
+ else
+ DVLOG(1) << render_view << " Unsupported histogram name";
+}
+
+// static
void SearchBoxExtensionWrapper::IsFocused(
const v8::FunctionCallbackInfo<v8::Value>& args) {
content::RenderView* render_view = GetRenderView();

Powered by Google App Engine
This is Rietveld 408576698