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

Side by Side Diff: chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc

Issue 2618603003: arc: Restore UMA statistics for failures in LSO flow. (Closed)
Patch Set: Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/auth/arc_manual_auth_code_fetcher.h" 5 #include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/chromeos/arc/arc_auth_context.h" 10 #include "chrome/browser/chromeos/arc/arc_auth_context.h"
11 #include "chrome/browser/chromeos/arc/arc_optin_uma.h"
11 12
12 namespace arc { 13 namespace arc {
13 14
14 ArcManualAuthCodeFetcher::ArcManualAuthCodeFetcher(ArcAuthContext* context, 15 ArcManualAuthCodeFetcher::ArcManualAuthCodeFetcher(ArcAuthContext* context,
15 ArcSupportHost* support_host) 16 ArcSupportHost* support_host)
16 : context_(context), support_host_(support_host), weak_ptr_factory_(this) { 17 : context_(context), support_host_(support_host), weak_ptr_factory_(this) {
17 DCHECK(context_); 18 DCHECK(context_);
18 DCHECK(support_host_); 19 DCHECK(support_host_);
19 support_host_->AddObserver(this); 20 support_host_->AddObserver(this);
20 } 21 }
(...skipping 12 matching lines...) Expand all
33 void ArcManualAuthCodeFetcher::FetchInternal() { 34 void ArcManualAuthCodeFetcher::FetchInternal() {
34 DCHECK(!pending_callback_.is_null()); 35 DCHECK(!pending_callback_.is_null());
35 context_->Prepare(base::Bind(&ArcManualAuthCodeFetcher::OnContextPrepared, 36 context_->Prepare(base::Bind(&ArcManualAuthCodeFetcher::OnContextPrepared,
36 weak_ptr_factory_.GetWeakPtr())); 37 weak_ptr_factory_.GetWeakPtr()));
37 } 38 }
38 39
39 void ArcManualAuthCodeFetcher::OnContextPrepared( 40 void ArcManualAuthCodeFetcher::OnContextPrepared(
40 net::URLRequestContextGetter* request_context_getter) { 41 net::URLRequestContextGetter* request_context_getter) {
41 DCHECK(!pending_callback_.is_null()); 42 DCHECK(!pending_callback_.is_null());
42 if (!request_context_getter) { 43 if (!request_context_getter) {
44 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
43 support_host_->ShowError(ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR, 45 support_host_->ShowError(ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR,
44 false); 46 false);
45 return; 47 return;
46 } 48 }
47 49
48 support_host_->ShowLso(); 50 support_host_->ShowLso();
49 } 51 }
50 52
51 void ArcManualAuthCodeFetcher::OnAuthSucceeded(const std::string& auth_code) { 53 void ArcManualAuthCodeFetcher::OnAuthSucceeded(const std::string& auth_code) {
52 DCHECK(!pending_callback_.is_null()); 54 DCHECK(!pending_callback_.is_null());
53 base::ResetAndReturn(&pending_callback_).Run(auth_code); 55 base::ResetAndReturn(&pending_callback_).Run(auth_code);
54 } 56 }
55 57
58 void ArcManualAuthCodeFetcher::OnAuthFailed() {
59 // Don't report via callback. Extension is already showing more detailed
60 // information. Update only UMA here.
61 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
62 }
63
56 void ArcManualAuthCodeFetcher::OnRetryClicked() { 64 void ArcManualAuthCodeFetcher::OnRetryClicked() {
57 DCHECK(!pending_callback_.is_null()); 65 DCHECK(!pending_callback_.is_null());
58 FetchInternal(); 66 FetchInternal();
59 } 67 }
60 68
61 } // namespace arc 69 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698