| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/chromeos/policy/cloud_external_data_policy_observer.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 void CloudExternalDataPolicyObserver::Init() { | 153 void CloudExternalDataPolicyObserver::Init() { |
| 154 RetrieveDeviceLocalAccounts(); | 154 RetrieveDeviceLocalAccounts(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void CloudExternalDataPolicyObserver::Observe( | 157 void CloudExternalDataPolicyObserver::Observe( |
| 158 int type, | 158 int type, |
| 159 const content::NotificationSource& source, | 159 const content::NotificationSource& source, |
| 160 const content::NotificationDetails& details) { | 160 const content::NotificationDetails& details) { |
| 161 if (type != chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) { | 161 DCHECK_EQ(chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, type); |
| 162 NOTREACHED(); | 162 |
| 163 return; | |
| 164 } | |
| 165 Profile* profile = content::Details<Profile>(details).ptr(); | 163 Profile* profile = content::Details<Profile>(details).ptr(); |
| 166 | |
| 167 const user_manager::User* user = | 164 const user_manager::User* user = |
| 168 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 165 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 169 if (!user) { | 166 if (!user) { |
| 170 NOTREACHED(); | 167 NOTREACHED(); |
| 171 return; | 168 return; |
| 172 } | 169 } |
| 173 | 170 |
| 174 const std::string& user_id = user->email(); | 171 const std::string& user_id = user->email(); |
| 175 if (ContainsKey(logged_in_user_observers_, user_id)) { | 172 if (ContainsKey(logged_in_user_observers_, user_id)) { |
| 176 NOTREACHED(); | 173 NOTREACHED(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void CloudExternalDataPolicyObserver::OnExternalDataFetched( | 297 void CloudExternalDataPolicyObserver::OnExternalDataFetched( |
| 301 const std::string& user_id, | 298 const std::string& user_id, |
| 302 std::unique_ptr<std::string> data) { | 299 std::unique_ptr<std::string> data) { |
| 303 FetchWeakPtrMap::iterator it = fetch_weak_ptrs_.find(user_id); | 300 FetchWeakPtrMap::iterator it = fetch_weak_ptrs_.find(user_id); |
| 304 DCHECK(it != fetch_weak_ptrs_.end()); | 301 DCHECK(it != fetch_weak_ptrs_.end()); |
| 305 fetch_weak_ptrs_.erase(it); | 302 fetch_weak_ptrs_.erase(it); |
| 306 delegate_->OnExternalDataFetched(policy_, user_id, std::move(data)); | 303 delegate_->OnExternalDataFetched(policy_, user_id, std::move(data)); |
| 307 } | 304 } |
| 308 | 305 |
| 309 } // namespace policy | 306 } // namespace policy |
| OLD | NEW |