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

Side by Side Diff: chrome/browser/metrics/perf_provider_chromeos.cc

Issue 450363002: Simplify LoginState methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check that retail mode is not used. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Name of the histogram that represents the success and various failure modes 79 // Name of the histogram that represents the success and various failure modes
80 // for collecting and sending perf data. 80 // for collecting and sending perf data.
81 const char kGetPerfDataOutcomeHistogram[] = "UMA.Perf.GetData"; 81 const char kGetPerfDataOutcomeHistogram[] = "UMA.Perf.GetData";
82 82
83 void AddToPerfHistogram(GetPerfDataOutcome outcome) { 83 void AddToPerfHistogram(GetPerfDataOutcome outcome) {
84 UMA_HISTOGRAM_ENUMERATION(kGetPerfDataOutcomeHistogram, 84 UMA_HISTOGRAM_ENUMERATION(kGetPerfDataOutcomeHistogram,
85 outcome, 85 outcome,
86 NUM_OUTCOMES); 86 NUM_OUTCOMES);
87 } 87 }
88 88
89 // Returns true if a normal user is logged in. Returns false if logged in as an 89 // Returns true if a normal user is logged in. Returns false otherwise (e.g. if
90 // guest or as a kiosk app. 90 // logged in as a guest or as a kiosk app).
91 bool IsNormalUserLoggedIn() { 91 bool IsNormalUserLoggedIn() {
92 chromeos::LoginState* login_state = chromeos::LoginState::Get(); 92 return chromeos::LoginState::Get()->IsUserAuthenticated();
93 return (login_state->IsUserLoggedIn() && !login_state->IsGuestUser() &&
94 !login_state->IsKioskApp());
95 } 93 }
96 94
97 } // namespace 95 } // namespace
98 96
99 97
100 namespace metrics { 98 namespace metrics {
101 99
102 // This class must be created and used on the UI thread. It watches for any 100 // This class must be created and used on the UI thread. It watches for any
103 // incognito window being opened from the time it is instantiated to the time it 101 // incognito window being opened from the time it is instantiated to the time it
104 // is destroyed. 102 // is destroyed.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 DCHECK(!login_time_.is_null()); 396 DCHECK(!login_time_.is_null());
399 collection_data. 397 collection_data.
400 set_ms_after_login((base::TimeTicks::Now() - login_time_) 398 set_ms_after_login((base::TimeTicks::Now() - login_time_)
401 .InMilliseconds()); 399 .InMilliseconds());
402 400
403 // Finally, store the perf data itself. 401 // Finally, store the perf data itself.
404 collection_data.mutable_perf_data()->Swap(&perf_data_proto); 402 collection_data.mutable_perf_data()->Swap(&perf_data_proto);
405 } 403 }
406 404
407 } // namespace metrics 405 } // namespace metrics
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/system_settings_provider.cc ('k') | chromeos/login/login_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698