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

Side by Side Diff: components/signin/core/browser/signin_status_metrics_provider.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/signin/core/browser/signin_status_metrics_provider.h" 5 #include "components/signin/core/browser/signin_status_metrics_provider.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
10 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
12 #include "components/signin/core/browser/signin_manager.h" 14 #include "components/signin/core/browser/signin_manager.h"
13 15
14 namespace { 16 namespace {
15 17
16 // The event of calling function ComputeCurrentSigninStatus and the errors 18 // The event of calling function ComputeCurrentSigninStatus and the errors
(...skipping 11 matching lines...) Expand all
28 void RecordComputeSigninStatusHistogram(ComputeSigninStatus status) { 30 void RecordComputeSigninStatusHistogram(ComputeSigninStatus status) {
29 UMA_HISTOGRAM_ENUMERATION("UMA.ComputeCurrentSigninStatus", status, 31 UMA_HISTOGRAM_ENUMERATION("UMA.ComputeCurrentSigninStatus", status,
30 COMPUTE_SIGNIN_STATUS_MAX); 32 COMPUTE_SIGNIN_STATUS_MAX);
31 } 33 }
32 34
33 } // namespace 35 } // namespace
34 36
35 SigninStatusMetricsProvider::SigninStatusMetricsProvider( 37 SigninStatusMetricsProvider::SigninStatusMetricsProvider(
36 scoped_ptr<SigninStatusMetricsProviderDelegate> delegate, 38 scoped_ptr<SigninStatusMetricsProviderDelegate> delegate,
37 bool is_test) 39 bool is_test)
38 : delegate_(delegate.Pass()), 40 : delegate_(std::move(delegate)),
39 scoped_observer_(this), 41 scoped_observer_(this),
40 is_test_(is_test), 42 is_test_(is_test),
41 weak_ptr_factory_(this) { 43 weak_ptr_factory_(this) {
42 DCHECK(delegate_ || is_test_); 44 DCHECK(delegate_ || is_test_);
43 if (is_test_) 45 if (is_test_)
44 return; 46 return;
45 47
46 delegate_->SetOwner(this); 48 delegate_->SetOwner(this);
47 49
48 // Postpone the initialization until all threads are created. 50 // Postpone the initialization until all threads are created.
(...skipping 10 matching lines...) Expand all
59 // After a histogram value is recorded, a new UMA session will be started, so 61 // After a histogram value is recorded, a new UMA session will be started, so
60 // we need to re-check the current sign-in status regardless of the previous 62 // we need to re-check the current sign-in status regardless of the previous
61 // recorded |signin_status_| value. 63 // recorded |signin_status_| value.
62 ResetSigninStatus(); 64 ResetSigninStatus();
63 ComputeCurrentSigninStatus(); 65 ComputeCurrentSigninStatus();
64 } 66 }
65 67
66 // static 68 // static
67 SigninStatusMetricsProvider* SigninStatusMetricsProvider::CreateInstance( 69 SigninStatusMetricsProvider* SigninStatusMetricsProvider::CreateInstance(
68 scoped_ptr<SigninStatusMetricsProviderDelegate> delegate) { 70 scoped_ptr<SigninStatusMetricsProviderDelegate> delegate) {
69 return new SigninStatusMetricsProvider(delegate.Pass(), false); 71 return new SigninStatusMetricsProvider(std::move(delegate), false);
70 } 72 }
71 73
72 void SigninStatusMetricsProvider::OnSigninManagerCreated( 74 void SigninStatusMetricsProvider::OnSigninManagerCreated(
73 SigninManagerBase* manager) { 75 SigninManagerBase* manager) {
74 // Whenever a new profile is created, a new SigninManagerBase will be created 76 // Whenever a new profile is created, a new SigninManagerBase will be created
75 // for it. This ensures that all sign-in or sign-out actions of all opened 77 // for it. This ensures that all sign-in or sign-out actions of all opened
76 // profiles are being monitored. 78 // profiles are being monitored.
77 scoped_observer_.Add(manager); 79 scoped_observer_.Add(manager);
78 80
79 // If the status is unknown, it means this is the first created 81 // If the status is unknown, it means this is the first created
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void SigninStatusMetricsProvider::UpdateInitialSigninStatusForTesting( 175 void SigninStatusMetricsProvider::UpdateInitialSigninStatusForTesting(
174 size_t total_count, 176 size_t total_count,
175 size_t signed_in_profiles_count) { 177 size_t signed_in_profiles_count) {
176 UpdateInitialSigninStatus(total_count, signed_in_profiles_count); 178 UpdateInitialSigninStatus(total_count, signed_in_profiles_count);
177 } 179 }
178 180
179 SigninStatusMetricsProvider::SigninStatus 181 SigninStatusMetricsProvider::SigninStatus
180 SigninStatusMetricsProvider::GetSigninStatusForTesting() { 182 SigninStatusMetricsProvider::GetSigninStatusForTesting() {
181 return signin_status(); 183 return signin_status();
182 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698