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

Side by Side Diff: chrome/browser/signin/signin_ui_util.cc

Issue 2354613002: [Sync] Fix namespaces for the browser_sync component. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/signin/signin_ui_util.h" 5 #include "chrome/browser/signin/signin_ui_util.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SyncGlobalError* error = SyncGlobalErrorFactory::GetForProfile(profile); 59 SyncGlobalError* error = SyncGlobalErrorFactory::GetForProfile(profile);
60 if (error && error->HasMenuItem()) 60 if (error && error->HasMenuItem())
61 errors.push_back(error); 61 errors.push_back(error);
62 } 62 }
63 #endif 63 #endif
64 64
65 return errors; 65 return errors;
66 } 66 }
67 67
68 // If a signed in service is reporting an error, returns the GlobalError 68 // If a signed in service is reporting an error, returns the GlobalError
69 // object associated with that service, or NULL if no errors are reported. 69 // object associated with that service, or null if no errors are reported.
70 GlobalError* GetSignedInServiceError(Profile* profile) { 70 GlobalError* GetSignedInServiceError(Profile* profile) {
71 std::vector<GlobalError*> errors = GetSignedInServiceErrors(profile); 71 std::vector<GlobalError*> errors = GetSignedInServiceErrors(profile);
72 if (errors.empty()) 72 if (errors.empty())
73 return NULL; 73 return nullptr;
74 return errors[0]; 74 return errors[0];
75 } 75 }
76 76
77 } // namespace 77 } // namespace
78 78
79 base::string16 GetSigninMenuLabel(Profile* profile) { 79 base::string16 GetSigninMenuLabel(Profile* profile) {
80 GlobalError* error = signin_ui_util::GetSignedInServiceError(profile); 80 GlobalError* error = signin_ui_util::GetSignedInServiceError(profile);
81 if (error) 81 if (error)
82 return error->MenuItemLabel(); 82 return error->MenuItemLabel();
83 83
84 // No errors, so just display the signed in user, if any. 84 // No errors, so just display the signed in user, if any.
85 ProfileSyncService* service = profile->IsSyncAllowed() ? 85 browser_sync::ProfileSyncService* service =
86 ProfileSyncServiceFactory::GetForProfile(profile) : NULL; 86 profile->IsSyncAllowed()
87 ? ProfileSyncServiceFactory::GetForProfile(profile)
88 : nullptr;
87 89
88 // Even if the user is signed in, don't display the "signed in as..." 90 // Even if the user is signed in, don't display the "signed in as..."
89 // label if we're still setting up sync. 91 // label if we're still setting up sync.
90 if (!service || !service->IsFirstSetupInProgress()) { 92 if (!service || !service->IsFirstSetupInProgress()) {
91 std::string username; 93 std::string username;
92 SigninManagerBase* signin_manager = 94 SigninManagerBase* signin_manager =
93 SigninManagerFactory::GetForProfileIfExists(profile); 95 SigninManagerFactory::GetForProfileIfExists(profile);
94 if (signin_manager) 96 if (signin_manager)
95 username = signin_manager->GetAuthenticatedAccountInfo().email; 97 username = signin_manager->GetAuthenticatedAccountInfo().email;
96 if (!username.empty() && !signin_manager->AuthInProgress()) { 98 if (!username.empty() && !signin_manager->AuthInProgress()) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 std::string email = account_tracker->GetAccountInfo(account_id).email; 189 std::string email = account_tracker->GetAccountInfo(account_id).email;
188 if (email.empty()) { 190 if (email.empty()) {
189 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED, 191 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED,
190 account_tracker->GetMigrationState()); 192 account_tracker->GetMigrationState());
191 return account_id; 193 return account_id;
192 } 194 }
193 return email; 195 return email;
194 } 196 }
195 197
196 } // namespace signin_ui_util 198 } // namespace signin_ui_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698