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

Unified Diff: chrome/browser/metrics/desktop_session/desktop_session_service.cc

Issue 2333113002: Rename DesktopEngagement* to DesktopSessionDuration*. (Closed)
Patch Set: Created 4 years, 3 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/browser/metrics/desktop_session/desktop_session_service.cc
diff --git a/chrome/browser/metrics/desktop_engagement/desktop_engagement_service.cc b/chrome/browser/metrics/desktop_session/desktop_session_service.cc
similarity index 73%
rename from chrome/browser/metrics/desktop_engagement/desktop_engagement_service.cc
rename to chrome/browser/metrics/desktop_session/desktop_session_service.cc
index 92e6c59601e2a4dcaed014cd8a6ef4c6081c6b84..0be6841cd82c6b03e063094f88ae3f005a9e8de9 100644
--- a/chrome/browser/metrics/desktop_engagement/desktop_engagement_service.cc
+++ b/chrome/browser/metrics/desktop_session/desktop_session_service.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/metrics/desktop_engagement/desktop_engagement_service.h"
+#include "chrome/browser/metrics/desktop_session/desktop_session_service.h"
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
@@ -13,33 +13,33 @@ namespace metrics {
namespace {
-DesktopEngagementService* g_instance = nullptr;
+DesktopSessionService* g_instance = nullptr;
} // namespace
// static
-void DesktopEngagementService::Initialize() {
- g_instance = new DesktopEngagementService;
+void DesktopSessionService::Initialize() {
+ g_instance = new DesktopSessionService;
}
// static
-bool DesktopEngagementService::IsInitialized() {
+bool DesktopSessionService::IsInitialized() {
return g_instance != nullptr;
}
// static
-DesktopEngagementService* DesktopEngagementService::Get() {
+DesktopSessionService* DesktopSessionService::Get() {
DCHECK(g_instance);
return g_instance;
}
-void DesktopEngagementService::StartTimer(base::TimeDelta duration) {
+void DesktopSessionService::StartTimer(base::TimeDelta duration) {
timer_.Start(FROM_HERE, duration,
- base::Bind(&DesktopEngagementService::OnTimerFired,
+ base::Bind(&DesktopSessionService::OnTimerFired,
weak_factory_.GetWeakPtr()));
}
-void DesktopEngagementService::OnVisibilityChanged(bool visible) {
+void DesktopSessionService::OnVisibilityChanged(bool visible) {
is_visible_ = visible;
if (is_visible_ && !is_first_session_) {
OnUserEvent();
@@ -49,7 +49,7 @@ void DesktopEngagementService::OnVisibilityChanged(bool visible) {
}
}
-void DesktopEngagementService::OnUserEvent() {
+void DesktopSessionService::OnUserEvent() {
if (!is_visible_)
return;
@@ -61,7 +61,7 @@ void DesktopEngagementService::OnUserEvent() {
}
}
-void DesktopEngagementService::OnAudioStart() {
+void DesktopSessionService::OnAudioStart() {
// This may start session.
is_audio_playing_ = true;
if (!in_session_) {
@@ -70,7 +70,7 @@ void DesktopEngagementService::OnAudioStart() {
}
}
-void DesktopEngagementService::OnAudioEnd() {
+void DesktopSessionService::OnAudioEnd() {
is_audio_playing_ = false;
// If the timer is not running, this means that no user events happened in the
@@ -81,7 +81,7 @@ void DesktopEngagementService::OnAudioEnd() {
}
}
-DesktopEngagementService::DesktopEngagementService()
+DesktopSessionService::DesktopSessionService()
: session_start_(base::TimeTicks::Now()),
last_user_event_(session_start_),
audio_tracker_(this),
@@ -89,9 +89,9 @@ DesktopEngagementService::DesktopEngagementService()
InitInactivityTimeout();
}
-DesktopEngagementService::~DesktopEngagementService() {}
+DesktopSessionService::~DesktopSessionService() {}
-void DesktopEngagementService::OnTimerFired() {
+void DesktopSessionService::OnTimerFired() {
base::TimeDelta remaining =
inactivity_timeout_ - (base::TimeTicks::Now() - last_user_event_);
if (remaining.ToInternalValue() > 0) {
@@ -106,14 +106,14 @@ void DesktopEngagementService::OnTimerFired() {
}
}
-void DesktopEngagementService::StartSession() {
+void DesktopSessionService::StartSession() {
in_session_ = true;
is_first_session_ = false;
session_start_ = base::TimeTicks::Now();
StartTimer(inactivity_timeout_);
}
-void DesktopEngagementService::EndSession() {
+void DesktopSessionService::EndSession() {
in_session_ = false;
base::TimeDelta delta = base::TimeTicks::Now() - session_start_;
@@ -124,12 +124,12 @@ void DesktopEngagementService::EndSession() {
UMA_HISTOGRAM_LONG_TIMES("Session.TotalDuration", delta);
}
-void DesktopEngagementService::InitInactivityTimeout() {
+void DesktopSessionService::InitInactivityTimeout() {
const int kDefaultInactivityTimeoutMinutes = 5;
int timeout_minutes = kDefaultInactivityTimeoutMinutes;
std::string param_value = variations::GetVariationParamValue(
- "DesktopEngagement", "inactivity_timeout");
+ "DesktopSession", "inactivity_timeout");
if (!param_value.empty())
base::StringToInt(param_value, &timeout_minutes);

Powered by Google App Engine
This is Rietveld 408576698