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

Side by Side Diff: ios/chrome/browser/browser_state_metrics/browser_state_metrics.cc

Issue 1544743002: Switch to standard integer types in ios/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "ios/chrome/browser/browser_state_metrics/browser_state_metrics.h" 5 #include "ios/chrome/browser/browser_state_metrics/browser_state_metrics.h"
6 6
7 #include <stddef.h>
8
7 #include "components/profile_metrics/counts.h" 9 #include "components/profile_metrics/counts.h"
8 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" 10 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h"
9 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state_ manager.h" 11 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state_ manager.h"
10 12
11 bool CountBrowserStateInformation(ios::ChromeBrowserStateManager* manager, 13 bool CountBrowserStateInformation(ios::ChromeBrowserStateManager* manager,
12 profile_metrics::Counts* counts) { 14 profile_metrics::Counts* counts) {
13 BrowserStateInfoCache* info_cache = manager->GetBrowserStateInfoCache(); 15 BrowserStateInfoCache* info_cache = manager->GetBrowserStateInfoCache();
14 size_t number_of_browser_states = info_cache->GetNumberOfBrowserStates(); 16 size_t number_of_browser_states = info_cache->GetNumberOfBrowserStates();
15 counts->total = number_of_browser_states; 17 counts->total = number_of_browser_states;
16 18
17 // Ignore other metrics if we have no browser states. 19 // Ignore other metrics if we have no browser states.
18 if (!number_of_browser_states) 20 if (!number_of_browser_states)
19 return false; 21 return false;
20 22
21 for (size_t i = 0; i < number_of_browser_states; ++i) { 23 for (size_t i = 0; i < number_of_browser_states; ++i) {
22 if (info_cache->BrowserStateIsAuthenticatedAtIndex(i)) { 24 if (info_cache->BrowserStateIsAuthenticatedAtIndex(i)) {
23 counts->signedin++; 25 counts->signedin++;
24 if (info_cache->BrowserStateIsAuthErrorAtIndex(i)) 26 if (info_cache->BrowserStateIsAuthErrorAtIndex(i))
25 counts->auth_errors++; 27 counts->auth_errors++;
26 } 28 }
27 } 29 }
28 return true; 30 return true;
29 } 31 }
30 32
31 void LogNumberOfBrowserStates(ios::ChromeBrowserStateManager* manager) { 33 void LogNumberOfBrowserStates(ios::ChromeBrowserStateManager* manager) {
32 profile_metrics::Counts counts; 34 profile_metrics::Counts counts;
33 CountBrowserStateInformation(manager, &counts); 35 CountBrowserStateInformation(manager, &counts);
34 profile_metrics::LogProfileMetricsCounts(counts); 36 profile_metrics::LogProfileMetricsCounts(counts);
35 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698