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

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

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 // The signin manager encapsulates some functionality tracking 5 // The signin manager encapsulates some functionality tracking
6 // which user is signed in. 6 // which user is signed in.
7 // 7 //
8 // **NOTE** on semantics of SigninManager: 8 // **NOTE** on semantics of SigninManager:
9 // 9 //
10 // Once a signin is successful, the username becomes "established" and will not 10 // Once a signin is successful, the username becomes "established" and will not
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h. 71 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h.
72 // If kSigninAllowed pref was non-Chrome OS-only, this method wouldn't be 72 // If kSigninAllowed pref was non-Chrome OS-only, this method wouldn't be
73 // needed, but as is we provide this method to let all interested code 73 // needed, but as is we provide this method to let all interested code
74 // code query the value in one way, versus half using PrefService directly 74 // code query the value in one way, versus half using PrefService directly
75 // and the other half using SigninManager. 75 // and the other half using SigninManager.
76 virtual bool IsSigninAllowed() const; 76 virtual bool IsSigninAllowed() const;
77 77
78 // If a user has previously signed in (and has not signed out), this returns 78 // If a user has previously signed in (and has not signed out), this returns
79 // the normalized email address of the account. Otherwise, it returns an empty 79 // the normalized email address of the account. Otherwise, it returns an empty
80 // string. 80 // string.
81 const std::string& GetAuthenticatedUsername() const; 81 std::string GetAuthenticatedUsername() const;
82 82
83 // If a user has previously signed in (and has not signed out), this returns 83 // If a user has previously signed in (and has not signed out), this returns
84 // the account id. Otherwise, it returns an empty string. This id can be used 84 // the account id. Otherwise, it returns an empty string. This id can be used
85 // to uniquely identify an account, so for example can be used as a key to 85 // to uniquely identify an account, so for example can be used as a key to
86 // map accounts to data. 86 // map accounts to data.
87 // 87 //
88 // TODO(rogerta): eventually the account id should be an obfuscated gaia id. 88 // TODO(rogerta): eventually the account id should be an obfuscated gaia id.
89 // For now though, this function returns the same value as 89 // For now though, this function returns the same value as
90 // GetAuthenticatedUsername() since lots of code assumes the unique id for an 90 // GetAuthenticatedUsername() since lots of code assumes the unique id for an
91 // account is the username. For code that needs a unique id to represent the 91 // account is the username. For code that needs a unique id to represent the
92 // connected account, call this method. Example: the AccountInfoMap type 92 // connected account, call this method. Example: the AccountInfoMap type
93 // in MutableProfileOAuth2TokenService. For code that needs to know the 93 // in MutableProfileOAuth2TokenService. For code that needs to know the
94 // normalized email address of the connected account, use 94 // normalized email address of the connected account, use
95 // GetAuthenticatedUsername(). Example: to show the string "Signed in as XXX" 95 // GetAuthenticatedUsername(). Example: to show the string "Signed in as XXX"
96 // in the hotdog menu. 96 // in the hotdog menu.
97 const std::string& GetAuthenticatedAccountId() const; 97 std::string GetAuthenticatedAccountId() const;
98 98
99 // Sets the user name. Note: |username| should be already authenticated as 99 // Sets the user name. Note: |username| should be already authenticated as
100 // this is a sticky operation (in contrast to StartSignIn). 100 // this is a sticky operation (in contrast to StartSignIn).
101 // TODO(tim): Remove this in favor of passing username on construction by 101 // TODO(tim): Remove this in favor of passing username on construction by
102 // (by platform / depending on StartBehavior). Bug 88109. 102 // (by platform / depending on StartBehavior). Bug 88109.
103 void SetAuthenticatedUsername(const std::string& username); 103 void SetAuthenticatedUsername(const std::string& username);
104 104
105 // Returns true if there is an authenticated user. 105 // Returns true if there is an authenticated user.
106 bool IsAuthenticated() const; 106 bool IsAuthenticated() const;
107 107
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // The list of SigninDiagnosticObservers. 152 // The list of SigninDiagnosticObservers.
153 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> 153 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true>
154 signin_diagnostics_observers_; 154 signin_diagnostics_observers_;
155 155
156 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_; 156 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase); 158 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase);
159 }; 159 };
160 160
161 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_ 161 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698