summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-30 01:04:50 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-30 01:04:50 +0000
commit15d04ae1405ec06bd43ff1f82bd2ffbc706d1b81 (patch)
treefa444b1ba15b2b54d94382788d0ee9d2833eeda4
parentc7526b25874021a49c043e30decf9cefdd5b966a (diff)
downloadchromium_src-15d04ae1405ec06bd43ff1f82bd2ffbc706d1b81.zip
chromium_src-15d04ae1405ec06bd43ff1f82bd2ffbc706d1b81.tar.gz
chromium_src-15d04ae1405ec06bd43ff1f82bd2ffbc706d1b81.tar.bz2
Add UMA stats for saving/printing PDFs (the printing will be done through the private Pepper API).
BUG=61142 Review URL: http://codereview.chromium.org/4158013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64528 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc3
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc8
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h1
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc7
-rw-r--r--chrome/browser/renderer_host/render_view_host.h2
-rw-r--r--chrome/common/render_messages_internal.h4
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--chrome/renderer/renderer_glue.cc5
-rw-r--r--webkit/glue/plugins/pepper_private.cc9
-rw-r--r--webkit/glue/plugins/ppb_private.h3
-rw-r--r--webkit/glue/webkit_glue.h3
-rw-r--r--webkit/support/webkit_support_glue.cc3
-rw-r--r--webkit/tools/test_shell/test_shell.cc3
13 files changed, 40 insertions, 13 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 7c1c05a..b238ce6 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1533,6 +1533,9 @@ void Browser::BookmarkCurrentPage() {
void Browser::SavePage() {
UserMetrics::RecordAction(UserMetricsAction("SavePage"), profile_);
+ TabContents* current_tab = GetSelectedTabContents();
+ if (current_tab && current_tab->contents_mime_type() == "application/pdf")
+ UserMetrics::RecordAction(UserMetricsAction("PDF.SavePage"), profile_);
GetSelectedTabContents()->OnSavePage();
}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index e72c7b1..47b0b8b 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/spellcheck_host.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -872,6 +873,8 @@ void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) {
OnExtensionRemoveListener)
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel,
OnExtensionCloseChannel)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
+ OnUserMetricsRecordAction)
IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary,
OnSpellCheckerRequestDictionary)
IPC_MESSAGE_UNHANDLED_ERROR()
@@ -1092,6 +1095,11 @@ void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) {
}
}
+void BrowserRenderProcessHost::OnUserMetricsRecordAction(
+ const std::string& action) {
+ UserMetrics::RecordComputedAction(action, profile());
+}
+
void BrowserRenderProcessHost::OnSpellCheckerRequestDictionary() {
if (profile()->GetSpellCheckHost()) {
// The spellchecker initialization already started and finished; just send
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 639ba32..841b6ae 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -113,6 +113,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
void OnExtensionRemoveListener(const std::string& extension_id,
const std::string& event_name);
void OnExtensionCloseChannel(int port_id);
+ void OnUserMetricsRecordAction(const std::string& action);
// Initialize support for visited links. Send the renderer process its initial
// set of visited links.
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index e4734b0..0f02f0e 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/in_process_webkit/session_storage_namespace.h"
-#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/profile.h"
@@ -841,8 +840,6 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
OnRequestUndockDevToolsWindow);
IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged,
OnDevToolsRuntimePropertyChanged);
- IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
- OnUserMetricsRecordAction)
IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus);
IPC_MESSAGE_HANDLER(ViewHostMsg_NonSandboxedPluginBlocked,
OnNonSandboxedPluginBlocked);
@@ -1585,10 +1582,6 @@ void RenderViewHost::OnDevToolsRuntimePropertyChanged(
RuntimePropertyChanged(this, name, value);
}
-void RenderViewHost::OnUserMetricsRecordAction(const std::string& action) {
- UserMetrics::RecordComputedAction(action, process()->profile());
-}
-
bool RenderViewHost::PreHandleKeyboardEvent(
const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 50d74c5..acca883 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -643,8 +643,6 @@ class RenderViewHost : public RenderWidgetHost {
void OnRequestUndockDevToolsWindow();
void OnDevToolsRuntimePropertyChanged(const std::string& name,
const std::string& value);
-
- void OnUserMetricsRecordAction(const std::string& action);
void OnMissingPluginStatus(int status);
void OnNonSandboxedPluginBlocked(const std::string& plugin,
const string16& name);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 353bfc9..0b43e31 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1821,8 +1821,8 @@ IPC_BEGIN_MESSAGES(ViewHost)
std::string /* value */)
// Send back a string to be recorded by UserMetrics.
- IPC_MESSAGE_ROUTED1(ViewHostMsg_UserMetricsRecordAction,
- std::string /* action */)
+ IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction,
+ std::string /* action */)
// Send back histograms as vector of pickled-histogram strings.
IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererHistograms,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 0996272..8631185 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -619,7 +619,7 @@ WebKit::WebView* RenderView::webview() const {
}
void RenderView::UserMetricsRecordAction(const std::string& action) {
- Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
+ Send(new ViewHostMsg_UserMetricsRecordAction(action));
}
void RenderView::PluginCrashed(const FilePath& plugin_path) {
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 7956bb7..9d70613 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -269,6 +269,11 @@ void EnableSpdy(bool enable) {
RenderThread::current()->EnableSpdy(enable);
}
+void UserMetricsRecordAction(const std::string& action) {
+ RenderThread::current()->Send(
+ new ViewHostMsg_UserMetricsRecordAction(action));
+}
+
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
diff --git a/webkit/glue/plugins/pepper_private.cc b/webkit/glue/plugins/pepper_private.cc
index 3cf9248..dd77abd 100644
--- a/webkit/glue/plugins/pepper_private.cc
+++ b/webkit/glue/plugins/pepper_private.cc
@@ -259,6 +259,12 @@ void HistogramPDFPageCount(int count) {
UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count);
}
+void UserMetricsRecordAction(PP_Var action) {
+ scoped_refptr<StringVar> action_str(StringVar::FromPPVar(action));
+ if (action_str)
+ webkit_glue::UserMetricsRecordAction(action_str->value());
+}
+
const PPB_Private ppb_private = {
&GetLocalizedString,
&GetResourceImage,
@@ -268,7 +274,8 @@ const PPB_Private ppb_private = {
&DidStartLoading,
&DidStopLoading,
&SetContentRestriction,
- &HistogramPDFPageCount
+ &HistogramPDFPageCount,
+ &UserMetricsRecordAction
};
} // namespace
diff --git a/webkit/glue/plugins/ppb_private.h b/webkit/glue/plugins/ppb_private.h
index 07b32ec..b922bd5d 100644
--- a/webkit/glue/plugins/ppb_private.h
+++ b/webkit/glue/plugins/ppb_private.h
@@ -126,6 +126,9 @@ struct PPB_Private {
// Use UMA so we know average pdf page count.
void (*HistogramPDFPageCount)(int count);
+
+ // Notifies the browser that the given action has been performed.
+ void (*UserMetricsRecordAction)(PP_Var action);
};
#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 380bf36..b745db4 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -274,6 +274,9 @@ bool IsSingleProcess();
// Enables/Disables Spdy for requests afterwards. Used for benchmarking.
void EnableSpdy(bool enable);
+// Notifies the browser that the given action has been performed.
+void UserMetricsRecordAction(const std::string& action);
+
#if defined(OS_LINUX)
// Return a read-only file descriptor to the font which best matches the given
// properties or -1 on failure.
diff --git a/webkit/support/webkit_support_glue.cc b/webkit/support/webkit_support_glue.cc
index cc8f4e9..ba2d859 100644
--- a/webkit/support/webkit_support_glue.cc
+++ b/webkit/support/webkit_support_glue.cc
@@ -79,6 +79,9 @@ bool IsSingleProcess() {
void EnableSpdy(bool enable) {
}
+void UserMetricsRecordAction(const std::string& action) {
+}
+
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index ee1ad6b..12797fe 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -856,6 +856,9 @@ void EnableSpdy(bool enable) {
// Used in benchmarking, Ignored for test_shell.
}
+void UserMetricsRecordAction(const std::string& action) {
+}
+
std::string GetProductVersion() {
return std::string("Chrome/0.0.0.0");
}