| OLD | NEW |
| 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 "chrome/browser/signin/signin_names_io_thread.h" | 5 #include "chrome/browser/signin/signin_names_io_thread.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 content::NotificationService::AllSources()); | 23 content::NotificationService::AllSources()); |
| 24 registrar_->Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 24 registrar_->Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
| 25 content::NotificationService::AllSources()); | 25 content::NotificationService::AllSources()); |
| 26 | 26 |
| 27 // Get list of profiles and record the email addresses of any connected | 27 // Get list of profiles and record the email addresses of any connected |
| 28 // accounts. | 28 // accounts. |
| 29 if (g_browser_process) { | 29 if (g_browser_process) { |
| 30 ProfileManager* manager = g_browser_process->profile_manager(); | 30 ProfileManager* manager = g_browser_process->profile_manager(); |
| 31 if (manager) { | 31 if (manager) { |
| 32 const ProfileInfoCache& cache = manager->GetProfileInfoCache(); | 32 const ProfileInfoCache& cache = manager->GetProfileInfoCache(); |
| 33 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 33 const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName(
)); |
| 34 string16 email = cache.GetUserNameOfProfileAtIndex(i); | 34 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 35 it != entries.end(); ++it) { |
| 36 string16 email = it->user_name(); |
| 35 if (!email.empty()) | 37 if (!email.empty()) |
| 36 emails_.insert(email); | 38 emails_.insert(email); |
| 37 } | 39 } |
| 38 } | 40 } |
| 39 } | 41 } |
| 40 } | 42 } |
| 41 | 43 |
| 42 SigninNamesOnIOThread::~SigninNamesOnIOThread() { | 44 SigninNamesOnIOThread::~SigninNamesOnIOThread() { |
| 43 CheckOnIOThread(); | 45 CheckOnIOThread(); |
| 44 DCHECK(!registrar_) << "Must call ReleaseResourcesOnUIThread() first"; | 46 DCHECK(!registrar_) << "Must call ReleaseResourcesOnUIThread() first"; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void SigninNamesOnIOThread::UpdateOnIOThread( | 107 void SigninNamesOnIOThread::UpdateOnIOThread( |
| 106 int type, | 108 int type, |
| 107 const string16& email) { | 109 const string16& email) { |
| 108 CheckOnIOThread(); | 110 CheckOnIOThread(); |
| 109 if (type == chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL) { | 111 if (type == chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL) { |
| 110 emails_.insert(email); | 112 emails_.insert(email); |
| 111 } else { | 113 } else { |
| 112 emails_.erase(email); | 114 emails_.erase(email); |
| 113 } | 115 } |
| 114 } | 116 } |
| OLD | NEW |