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

Unified Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2922383002: [Merge M60] arc: Provide metric to monitor Play Store window is shown time. (Closed)
Patch Set: Created 3 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/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
index 876e5910982467bcca8f2bc5348d9afdeca5e2c4..411fd51ff79de1f75b95c1c4d1d568d151d980f2 100644
--- a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
@@ -16,7 +16,9 @@
#include "ash/wm_window.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
+#include "chrome/browser/chromeos/arc/arc_optin_uma.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
+#include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/ash/launcher/arc_app_window.h"
@@ -150,6 +152,8 @@ ArcAppWindowLauncherController::ArcAppWindowLauncherController(
if (arc::IsArcAllowedForProfile(owner->profile())) {
observed_profile_ = owner->profile();
StartObserving(observed_profile_);
+
+ arc::ArcSessionManager::Get()->AddObserver(this);
}
}
@@ -158,6 +162,8 @@ ArcAppWindowLauncherController::~ArcAppWindowLauncherController() {
StopObserving(observed_profile_);
if (observing_shell_)
ash::Shell::Get()->RemoveShellObserver(this);
+ if (arc::ArcSessionManager::Get())
+ arc::ArcSessionManager::Get()->RemoveObserver(this);
}
void ArcAppWindowLauncherController::ActiveUserChanged(
@@ -491,6 +497,16 @@ ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) {
return nullptr;
}
+void ArcAppWindowLauncherController::OnArcOptInManagementCheckStarted() {
+ // In case of retry this time is updated and we measure only successful run.
+ opt_in_management_check_start_time_ = base::Time::Now();
+}
+
+void ArcAppWindowLauncherController::OnArcSessionStopped(
+ arc::ArcStopReason stop_reason) {
+ opt_in_management_check_start_time_ = base::Time();
+}
+
void ArcAppWindowLauncherController::OnWindowActivated(
aura::client::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
@@ -576,6 +592,14 @@ void ArcAppWindowLauncherController::RegisterApp(
owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
app_window->SetController(controller);
app_window->set_shelf_id(shelf_id);
+
+ if (!opt_in_management_check_start_time_.is_null() &&
+ app_window_info->app_shelf_id().app_id() == arc::kPlayStoreAppId) {
+ arc::UpdatePlayStoreShowTime(
+ base::Time::Now() - opt_in_management_check_start_time_,
+ arc::policy_util::IsAccountManaged(owner()->profile()));
+ opt_in_management_check_start_time_ = base::Time();
+ }
}
void ArcAppWindowLauncherController::UnregisterApp(
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698