Commit 2f0dd4ee authored by Jialiu Lin's avatar Jialiu Lin Committed by Commit Bot

Record UMA metrics to track content area sizes

Reocrd content area sizes when a new browser window is opened and when
the user resizes a browser window.

This is part of preliminary metrics collection for vision-based
phishing protection.

Bug: 882942
Change-Id: Ib6db98bf13193784b89029f467906ed4e0b3ffc4
Reviewed-on: https://chromium-review.googlesource.com/1228957
Commit-Queue: Jialiu Lin <jialiul@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594031}
parent 1364b08c
...@@ -3663,6 +3663,7 @@ jumbo_split_static_library("ui") { ...@@ -3663,6 +3663,7 @@ jumbo_split_static_library("ui") {
"//chrome/browser/ui/webui/reset_password:mojo_bindings", "//chrome/browser/ui/webui/reset_password:mojo_bindings",
"//chrome/common/safe_browsing:proto", "//chrome/common/safe_browsing:proto",
"//components/safe_browsing:csd_proto", "//components/safe_browsing:csd_proto",
"//components/safe_browsing/password_protection:password_protection_metrics_util",
] ]
} }
......
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
#include "components/omnibox/browser/omnibox_popup_view.h" #include "components/omnibox/browser/omnibox_popup_view.h"
#include "components/omnibox/browser/omnibox_view.h" #include "components/omnibox/browser/omnibox_view.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/safe_browsing/password_protection/metrics_util.h"
#include "components/sessions/core/tab_restore_service.h" #include "components/sessions/core/tab_restore_service.h"
#include "components/signin/core/browser/profile_management_switches.h" #include "components/signin/core/browser/profile_management_switches.h"
#include "components/translate/core/browser/language_state.h" #include "components/translate/core/browser/language_state.h"
...@@ -2085,6 +2086,7 @@ void BrowserView::OnWindowBeginUserBoundsChange() { ...@@ -2085,6 +2086,7 @@ void BrowserView::OnWindowBeginUserBoundsChange() {
void BrowserView::OnWindowEndUserBoundsChange() { void BrowserView::OnWindowEndUserBoundsChange() {
if (!interactive_resize_) if (!interactive_resize_)
return; return;
safe_browsing::LogContentsSize(GetContentsSize());
auto now = base::TimeTicks::Now(); auto now = base::TimeTicks::Now();
DCHECK(!interactive_resize_->begin_timestamp.is_null()); DCHECK(!interactive_resize_->begin_timestamp.is_null());
UMA_HISTOGRAM_TIMES("BrowserWindow.Resize.Duration", UMA_HISTOGRAM_TIMES("BrowserWindow.Resize.Duration",
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
#include "chrome/browser/ui/views_mode_controller.h" #include "chrome/browser/ui/views_mode_controller.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "components/safe_browsing/password_protection/metrics_util.h"
#if defined(USE_AURA) #if defined(USE_AURA)
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -40,5 +41,6 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow( ...@@ -40,5 +41,6 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(
view->GetWidget()->GetNativeWindow()->SetProperty( view->GetWidget()->GetNativeWindow()->SetProperty(
aura::client::kCreatedByUserGesture, user_gesture); aura::client::kCreatedByUserGesture, user_gesture);
#endif #endif
safe_browsing::LogContentsSize(view->GetContentsSize());
return view; return view;
} }
...@@ -50,6 +50,7 @@ source_set("password_protection_metrics_util") { ...@@ -50,6 +50,7 @@ source_set("password_protection_metrics_util") {
"//base", "//base",
"//components/safe_browsing:csd_proto", "//components/safe_browsing:csd_proto",
"//net:net", "//net:net",
"//ui/gfx/geometry:geometry",
] ]
} }
......
...@@ -9,5 +9,6 @@ include_rules = [ ...@@ -9,5 +9,6 @@ include_rules = [
"+net", "+net",
"+services/network/public", "+services/network/public",
"+services/network/test", "+services/network/test",
"+ui/gfx/geometry",
] ]
...@@ -238,4 +238,11 @@ void LogNumberOfReuseBeforeSyncPasswordChange(size_t reuse_count) { ...@@ -238,4 +238,11 @@ void LogNumberOfReuseBeforeSyncPasswordChange(size_t reuse_count) {
reuse_count); reuse_count);
} }
void LogContentsSize(const gfx::Size& size) {
if (size.width() <= 0 || size.height() <= 0)
return;
UMA_HISTOGRAM_COUNTS_10000("SafeBrowsing.ContentsSize.Width", size.width());
UMA_HISTOGRAM_COUNTS_10000("SafeBrowsing.ContentsSize.Height", size.height());
}
} // namespace safe_browsing } // namespace safe_browsing
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/safe_browsing/proto/csd.pb.h" #include "components/safe_browsing/proto/csd.pb.h"
#include "ui/gfx/geometry/size.h"
namespace base { namespace base {
class TimeTicks; class TimeTicks;
...@@ -183,6 +184,9 @@ void LogReferrerChainSize( ...@@ -183,6 +184,9 @@ void LogReferrerChainSize(
LoginReputationClientResponse::VerdictType verdict_type, LoginReputationClientResponse::VerdictType verdict_type,
int referrer_chain_size); int referrer_chain_size);
// Logs the content area size in DIPs.
void LogContentsSize(const gfx::Size& size);
} // namespace safe_browsing } // namespace safe_browsing
#endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_METRICS_UTIL_H_ #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_METRICS_UTIL_H_
...@@ -86748,6 +86748,26 @@ uploading your change for review. ...@@ -86748,6 +86748,26 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="SafeBrowsing.ContentsSize.Height" units="DIPs"
expires_after="M73">
<owner>jialiul@chrormium.org</owner>
<owner>nparker@chromium.org</owner>
<summary>
Records the height of content area when the user opens a new browser window
or when the user finishes resizing a browser window.
</summary>
</histogram>
<histogram name="SafeBrowsing.ContentsSize.Width" units="DIPs"
expires_after="M73">
<owner>jialiul@chrormium.org</owner>
<owner>nparker@chromium.org</owner>
<summary>
Records the width of content area when the user opens a new browser window
or when the user finishes resizing a browser window.
</summary>
</histogram>
<histogram name="SafeBrowsing.EnabledSettingChanged" enum="BooleanEnabled"> <histogram name="SafeBrowsing.EnabledSettingChanged" enum="BooleanEnabled">
<obsolete> <obsolete>
Not in the code anymore (10/2015). Not in the code anymore (10/2015).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment