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

Side by Side Diff: components/signin/core/browser/about_signin_internals.h

Issue 2461223003: Remove stl_util's deletion function use from components/signin/. (Closed)
Patch Set: more loop Created 4 years, 1 month 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
« no previous file with comments | « no previous file | components/signin/core/browser/about_signin_internals.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 14 matching lines...) Expand all
25 class PrefRegistrySyncable; 25 class PrefRegistrySyncable;
26 } 26 }
27 27
28 class AccountTrackerService; 28 class AccountTrackerService;
29 class GaiaAuthFetcher; 29 class GaiaAuthFetcher;
30 class ProfileOAuth2TokenService; 30 class ProfileOAuth2TokenService;
31 class SigninClient; 31 class SigninClient;
32 32
33 // Many values in SigninStatus are also associated with a timestamp. 33 // Many values in SigninStatus are also associated with a timestamp.
34 // This makes it easier to keep values and their associated times together. 34 // This makes it easier to keep values and their associated times together.
35 typedef std::pair<std::string, std::string> TimedSigninStatusValue; 35 using TimedSigninStatusValue = std::pair<std::string, std::string>;
36 36
37 // This class collects authentication, signin and token information 37 // This class collects authentication, signin and token information
38 // to propagate to about:signin-internals via SigninInternalsUI. 38 // to propagate to about:signin-internals via SigninInternalsUI.
39 class AboutSigninInternals 39 class AboutSigninInternals
40 : public KeyedService, 40 : public KeyedService,
41 public signin_internals_util::SigninDiagnosticsObserver, 41 public signin_internals_util::SigninDiagnosticsObserver,
42 public OAuth2TokenService::DiagnosticsObserver, 42 public OAuth2TokenService::DiagnosticsObserver,
43 public GaiaCookieManagerService::Observer, 43 public GaiaCookieManagerService::Observer,
44 SigninManagerBase::Observer, 44 SigninManagerBase::Observer,
45 SigninErrorController::Observer { 45 SigninErrorController::Observer {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const GoogleServiceAuthError& error) override; 103 const GoogleServiceAuthError& error) override;
104 104
105 private: 105 private:
106 // Encapsulates diagnostic information about tokens for different services. 106 // Encapsulates diagnostic information about tokens for different services.
107 struct TokenInfo { 107 struct TokenInfo {
108 TokenInfo(const std::string& consumer_id, 108 TokenInfo(const std::string& consumer_id,
109 const OAuth2TokenService::ScopeSet& scopes); 109 const OAuth2TokenService::ScopeSet& scopes);
110 ~TokenInfo(); 110 ~TokenInfo();
111 std::unique_ptr<base::DictionaryValue> ToValue() const; 111 std::unique_ptr<base::DictionaryValue> ToValue() const;
112 112
113 static bool LessThan(const TokenInfo* a, const TokenInfo* b); 113 static bool LessThan(const std::unique_ptr<TokenInfo>& a,
114 const std::unique_ptr<TokenInfo>& b);
114 115
115 // Called when the token is invalidated. 116 // Called when the token is invalidated.
116 void Invalidate(); 117 void Invalidate();
117 118
118 std::string consumer_id; // service that requested the token. 119 std::string consumer_id; // service that requested the token.
119 OAuth2TokenService::ScopeSet scopes; // Scoped that are requested. 120 OAuth2TokenService::ScopeSet scopes; // Scoped that are requested.
120 base::Time request_time; 121 base::Time request_time;
121 base::Time receive_time; 122 base::Time receive_time;
122 base::Time expiration_time; 123 base::Time expiration_time;
123 GoogleServiceAuthError error; 124 GoogleServiceAuthError error;
124 bool removed_; 125 bool removed_;
125 }; 126 };
126 127
127 // Map account id to tokens associated to the account.
128 typedef std::map<std::string, std::vector<TokenInfo*> > TokenInfoMap;
129
130 // Encapsulates both authentication and token related information. Used 128 // Encapsulates both authentication and token related information. Used
131 // by SigninInternals to maintain information that needs to be shown in 129 // by SigninInternals to maintain information that needs to be shown in
132 // the about:signin-internals page. 130 // the about:signin-internals page.
133 struct SigninStatus { 131 struct SigninStatus {
134 std::vector<TimedSigninStatusValue> timed_signin_fields; 132 std::vector<TimedSigninStatusValue> timed_signin_fields;
135 TokenInfoMap token_info_map; 133
134 // Map account id to tokens associated to the account.
135 std::map<std::string, std::vector<std::unique_ptr<TokenInfo>>>
136 token_info_map;
136 137
137 SigninStatus(); 138 SigninStatus();
138 ~SigninStatus(); 139 ~SigninStatus();
139 140
140 TokenInfo* FindToken(const std::string& account_id, 141 TokenInfo* FindToken(const std::string& account_id,
141 const std::string& consumer_id, 142 const std::string& consumer_id,
142 const OAuth2TokenService::ScopeSet& scopes); 143 const OAuth2TokenService::ScopeSet& scopes);
143 144
144 // Returns a dictionary with the following form: 145 // Returns a dictionary with the following form:
145 // { "signin_info" : 146 // { "signin_info" :
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Encapsulates the actual signin and token related values. 220 // Encapsulates the actual signin and token related values.
220 // Most of the values are mirrored in the prefs for persistence. 221 // Most of the values are mirrored in the prefs for persistence.
221 SigninStatus signin_status_; 222 SigninStatus signin_status_;
222 223
223 base::ObserverList<Observer> signin_observers_; 224 base::ObserverList<Observer> signin_observers_;
224 225
225 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); 226 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals);
226 }; 227 };
227 228
228 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ 229 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_
OLDNEW
« no previous file with comments | « no previous file | components/signin/core/browser/about_signin_internals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698