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

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: Rebased Created 7 years, 6 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 e2779ee165925af414af3fd984df058fc1fce34f..48b8524456a0b4b24fb6654bebb2cce9a659a81f 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,24 @@ 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();
beaudoin 2013/07/04 16:12:03 In the else case we should probably DVLOG(1) that
annark1 2013/07/04 19:25:09 Done.
+}
+
+// static
void SearchBoxExtensionWrapper::IsFocused(
const v8::FunctionCallbackInfo<v8::Value>& args) {
content::RenderView* render_view = GetRenderView();

Powered by Google App Engine
This is Rietveld 408576698