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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2704383006: arc: Handle metrics for Auth operations. (Closed)
Patch Set: nit in histograms.xml Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/time/time.h"
11 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" 12 #include "chrome/browser/chromeos/arc/arc_optin_uma.h"
12 #include "chrome/browser/chromeos/arc/arc_session_manager.h" 13 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
13 #include "chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token _fetcher.h" 14 #include "chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token _fetcher.h"
14 #include "chrome/browser/chromeos/arc/auth/arc_auth_info_fetcher.h" 15 #include "chrome/browser/chromeos/arc/auth/arc_auth_info_fetcher.h"
15 #include "chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h" 16 #include "chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h"
16 #include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h" 17 #include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h"
17 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher.h" 18 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher.h"
18 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" 19 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 20 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/lifetime/application_lifetime.h" 21 #include "chrome/browser/lifetime/application_lifetime.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ConvertArcSignInFailureReasonToProvisioningResult(reason)); 170 ConvertArcSignInFailureReasonToProvisioningResult(reason));
170 } 171 }
171 172
172 void ArcAuthService::RequestAccountInfo() { 173 void ArcAuthService::RequestAccountInfo() {
173 RequestAccountInfoInternal( 174 RequestAccountInfoInternal(
174 base::MakeUnique<ArcAuthService::AccountInfoNotifier>( 175 base::MakeUnique<ArcAuthService::AccountInfoNotifier>(
175 base::Bind(&ArcAuthService::OnAccountInfoReady, 176 base::Bind(&ArcAuthService::OnAccountInfoReady,
176 weak_ptr_factory_.GetWeakPtr()))); 177 weak_ptr_factory_.GetWeakPtr())));
177 } 178 }
178 179
180 void ArcAuthService::ReportMetrics(mojom::MetricsType metrics_type,
181 int32_t value) {
182 switch (metrics_type) {
183 case mojom::MetricsType::NETWORK_WAITING_TIME_MILLISECONDS:
184 UpdateAuthTiming("ArcAuth.NetworkWaitTime",
185 base::TimeDelta::FromMilliseconds(value));
186 break;
187 case mojom::MetricsType::CHECKIN_ATTEMPTS:
188 UpdateAuthCheckinAttempts(value);
189 break;
190 case mojom::MetricsType::CHECKIN_TIME_MILLISECONDS:
191 UpdateAuthTiming("ArcAuth.CheckinTime",
192 base::TimeDelta::FromMilliseconds(value));
193 break;
194 case mojom::MetricsType::SIGNIN_TIME_MILLISECONDS:
195 UpdateAuthTiming("ArcAuth.SignInTime",
196 base::TimeDelta::FromMilliseconds(value));
197 break;
198 }
199 }
200
179 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) { 201 void ArcAuthService::OnAccountInfoReady(mojom::AccountInfoPtr account_info) {
180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 202 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
181 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(), 203 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->auth(),
182 OnAccountInfoReady); 204 OnAccountInfoReady);
183 DCHECK(instance); 205 DCHECK(instance);
184 instance->OnAccountInfoReady(std::move(account_info)); 206 instance->OnAccountInfoReady(std::move(account_info));
185 } 207 }
186 208
187 void ArcAuthService::GetAuthCodeDeprecated0( 209 void ArcAuthService::GetAuthCodeDeprecated0(
188 const GetAuthCodeDeprecated0Callback& callback) { 210 const GetAuthCodeDeprecated0Callback& callback) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return; 314 return;
293 } 315 }
294 316
295 notifier_->Notify( 317 notifier_->Notify(
296 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(), 318 !IsArcOptInVerificationDisabled(), auth_code, GetAccountType(),
297 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile())); 319 policy_util::IsAccountManaged(ArcSessionManager::Get()->profile()));
298 notifier_.reset(); 320 notifier_.reset();
299 } 321 }
300 322
301 } // namespace arc 323 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | chrome/browser/chromeos/arc/arc_optin_uma.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698