OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" | 5 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 InstallExtensionCallback callback) { | 280 InstallExtensionCallback callback) { |
281 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 281 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
282 | 282 |
283 const std::string& user_id = profile->GetProfileUserName(); | 283 const std::string& user_id = profile->GetProfileUserName(); |
284 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 284 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
285 if (!user_manager) { | 285 if (!user_manager) { |
286 NOTREACHED(); | 286 NOTREACHED(); |
287 return; | 287 return; |
288 } | 288 } |
289 | 289 |
290 if (user_manager->IsUserNonCryptohomeDataEphemeral( | 290 if (user_manager->IsUserNonCryptohomeDataEphemeral(user_id) || |
291 AccountId::FromUserEmail(user_id)) || | |
292 !user_manager->IsLoggedInAsUserWithGaiaAccount()) { | 291 !user_manager->IsLoggedInAsUserWithGaiaAccount()) { |
293 // Don't cache anything in shared location for ephemeral user or special | 292 // Don't cache anything in shared location for ephemeral user or special |
294 // user types. | 293 // user types. |
295 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask( | 294 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask( |
296 FROM_HERE, | 295 FROM_HERE, |
297 base::Bind(&ExtensionAssetsManagerChromeOS::InstallLocalExtension, | 296 base::Bind(&ExtensionAssetsManagerChromeOS::InstallLocalExtension, |
298 id, | 297 id, |
299 version, | 298 version, |
300 unpacked_extension_root, | 299 unpacked_extension_root, |
301 local_install_dir, | 300 local_install_dir, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 return false; | 523 return false; |
525 } | 524 } |
526 | 525 |
527 size_t num_users = users->GetSize(); | 526 size_t num_users = users->GetSize(); |
528 for (size_t i = 0; i < num_users; i++) { | 527 for (size_t i = 0; i < num_users; i++) { |
529 std::string user_id; | 528 std::string user_id; |
530 if (!users->GetString(i, &user_id)) { | 529 if (!users->GetString(i, &user_id)) { |
531 NOTREACHED(); | 530 NOTREACHED(); |
532 return false; | 531 return false; |
533 } | 532 } |
534 const user_manager::User* user = | 533 const user_manager::User* user = user_manager->FindUser(user_id); |
535 user_manager->FindUser(AccountId::FromUserEmail(user_id)); | |
536 bool not_used = false; | 534 bool not_used = false; |
537 if (!user) { | 535 if (!user) { |
538 not_used = true; | 536 not_used = true; |
539 } else if (user->is_logged_in()) { | 537 } else if (user->is_logged_in()) { |
540 // For logged in user also check that this path is actually used as | 538 // For logged in user also check that this path is actually used as |
541 // installed extension or as delayed install. | 539 // installed extension or as delayed install. |
542 Profile* profile = | 540 Profile* profile = |
543 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 541 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
544 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); | 542 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); |
545 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly()) | 543 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly()) |
(...skipping 22 matching lines...) Expand all Loading... |
568 std::make_pair(id, base::FilePath(shared_path))); | 566 std::make_pair(id, base::FilePath(shared_path))); |
569 } else { | 567 } else { |
570 extension_info->RemoveWithoutPathExpansion(*it, NULL); | 568 extension_info->RemoveWithoutPathExpansion(*it, NULL); |
571 } | 569 } |
572 } | 570 } |
573 | 571 |
574 return true; | 572 return true; |
575 } | 573 } |
576 | 574 |
577 } // namespace extensions | 575 } // namespace extensions |
OLD | NEW |