| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 not_used = true; | 541 not_used = true; |
| 542 } else if (user->is_logged_in()) { | 542 } else if (user->is_logged_in()) { |
| 543 // For logged in user also check that this path is actually used as | 543 // For logged in user also check that this path is actually used as |
| 544 // installed extension or as delayed install. | 544 // installed extension or as delayed install. |
| 545 Profile* profile = | 545 Profile* profile = |
| 546 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 546 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 547 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); | 547 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); |
| 548 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly()) | 548 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly()) |
| 549 return false; | 549 return false; |
| 550 | 550 |
| 551 scoped_ptr<ExtensionInfo> info = | 551 std::unique_ptr<ExtensionInfo> info = |
| 552 extension_prefs->GetInstalledExtensionInfo(id); | 552 extension_prefs->GetInstalledExtensionInfo(id); |
| 553 if (!info || info->extension_path != base::FilePath(shared_path)) { | 553 if (!info || info->extension_path != base::FilePath(shared_path)) { |
| 554 info = extension_prefs->GetDelayedInstallInfo(id); | 554 info = extension_prefs->GetDelayedInstallInfo(id); |
| 555 if (!info || info->extension_path != base::FilePath(shared_path)) { | 555 if (!info || info->extension_path != base::FilePath(shared_path)) { |
| 556 not_used = true; | 556 not_used = true; |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 if (not_used) { | 561 if (not_used) { |
| 562 users->Remove(i, NULL); | 562 users->Remove(i, NULL); |
| 563 | 563 |
| 564 i--; | 564 i--; |
| 565 num_users--; | 565 num_users--; |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 if (num_users) { | 569 if (num_users) { |
| 570 live_extension_paths->insert( | 570 live_extension_paths->insert( |
| 571 std::make_pair(id, base::FilePath(shared_path))); | 571 std::make_pair(id, base::FilePath(shared_path))); |
| 572 } else { | 572 } else { |
| 573 extension_info->RemoveWithoutPathExpansion(*it, NULL); | 573 extension_info->RemoveWithoutPathExpansion(*it, NULL); |
| 574 } | 574 } |
| 575 } | 575 } |
| 576 | 576 |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 | 579 |
| 580 } // namespace extensions | 580 } // namespace extensions |
| OLD | NEW |