diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-30 01:09:37 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-30 01:09:37 +0000 |
commit | 06bab48002b8d71d3ed58d232af6b790cafa0ee3 (patch) | |
tree | e4bf52902ade6f27aa0a68ee5c6a132981914ae4 | |
parent | b984bcb1ca8440b6c9fa3d9ffec4874ff77c7bad (diff) | |
download | chromium_src-06bab48002b8d71d3ed58d232af6b790cafa0ee3.zip chromium_src-06bab48002b8d71d3ed58d232af6b790cafa0ee3.tar.gz chromium_src-06bab48002b8d71d3ed58d232af6b790cafa0ee3.tar.bz2 |
Merge 64528 - 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
TBR=jam@chromium.org
Review URL: http://codereview.chromium.org/4135012
git-svn-id: svn://svn.chromium.org/chrome/branches/552/src@64529 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 3 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.h | 1 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 7 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 2 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/renderer_glue.cc | 5 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_private.cc | 9 | ||||
-rw-r--r-- | webkit/glue/plugins/ppb_private.h | 3 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 3 | ||||
-rw-r--r-- | webkit/support/webkit_support_glue.cc | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 3 |
13 files changed, 40 insertions, 13 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index ba595ad..16660b1 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1538,6 +1538,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 25208db..43585f9 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -46,6 +46,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" @@ -867,6 +868,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() @@ -1085,6 +1088,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 9983c84..f3fbd14 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -111,6 +111,7 @@ class BrowserRenderProcessHost : public RenderProcessHost, void OnExtensionAddListener(const std::string& event_name); void OnExtensionRemoveListener(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 c91671f..33a2c65 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" @@ -833,8 +832,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); @@ -1567,10 +1564,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 76f1f01..d1f0ce0 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -631,8 +631,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 75eacdf..32d816b 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1787,8 +1787,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 9f4b43d..8b0a3f0 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -598,7 +598,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 7215e32..218ac1e 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -271,6 +271,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 9532dbd..ece4c71 100644 --- a/webkit/glue/plugins/pepper_private.cc +++ b/webkit/glue/plugins/pepper_private.cc @@ -258,6 +258,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, @@ -267,7 +273,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 4f5ae00..7e91799 100644 --- a/webkit/glue/plugins/ppb_private.h +++ b/webkit/glue/plugins/ppb_private.h @@ -125,6 +125,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 9213f6b..6fd7b3d 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -853,6 +853,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"); } |