OLD | NEW |
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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 CHECK(extension); | 2425 CHECK(extension); |
2426 delayed_updates_for_idle_.Remove(extension_id); | 2426 delayed_updates_for_idle_.Remove(extension_id); |
2427 | 2427 |
2428 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) | 2428 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) |
2429 NOTREACHED(); | 2429 NOTREACHED(); |
2430 | 2430 |
2431 FinishInstallation(extension); | 2431 FinishInstallation(extension); |
2432 } | 2432 } |
2433 | 2433 |
2434 void ExtensionService::FinishInstallation(const Extension* extension) { | 2434 void ExtensionService::FinishInstallation(const Extension* extension) { |
2435 bool is_update = GetInstalledExtension(extension->id()) != NULL; | 2435 const extensions::Extension* existing_extension = |
2436 extensions::InstalledExtensionInfo details(extension, is_update); | 2436 GetInstalledExtension(extension->id()); |
| 2437 bool is_update = false; |
| 2438 std::string old_name; |
| 2439 if (existing_extension) { |
| 2440 is_update = true; |
| 2441 old_name = existing_extension->name(); |
| 2442 } |
| 2443 extensions::InstalledExtensionInfo details(extension, is_update, old_name); |
2437 content::NotificationService::current()->Notify( | 2444 content::NotificationService::current()->Notify( |
2438 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 2445 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
2439 content::Source<Profile>(profile_), | 2446 content::Source<Profile>(profile_), |
2440 content::Details<const extensions::InstalledExtensionInfo>(&details)); | 2447 content::Details<const extensions::InstalledExtensionInfo>(&details)); |
2441 | 2448 |
2442 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); | 2449 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); |
2443 | 2450 |
2444 // Unpacked extensions default to allowing file access, but if that has been | 2451 // Unpacked extensions default to allowing file access, but if that has been |
2445 // overridden, don't reset the value. | 2452 // overridden, don't reset the value. |
2446 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && | 2453 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3116 } | 3123 } |
3117 | 3124 |
3118 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3125 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3119 update_observers_.AddObserver(observer); | 3126 update_observers_.AddObserver(observer); |
3120 } | 3127 } |
3121 | 3128 |
3122 void ExtensionService::RemoveUpdateObserver( | 3129 void ExtensionService::RemoveUpdateObserver( |
3123 extensions::UpdateObserver* observer) { | 3130 extensions::UpdateObserver* observer) { |
3124 update_observers_.RemoveObserver(observer); | 3131 update_observers_.RemoveObserver(observer); |
3125 } | 3132 } |
OLD | NEW |