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 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 CHECK(extension); | 2418 CHECK(extension); |
2419 delayed_updates_for_idle_.Remove(extension_id); | 2419 delayed_updates_for_idle_.Remove(extension_id); |
2420 | 2420 |
2421 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) | 2421 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) |
2422 NOTREACHED(); | 2422 NOTREACHED(); |
2423 | 2423 |
2424 FinishInstallation(extension); | 2424 FinishInstallation(extension); |
2425 } | 2425 } |
2426 | 2426 |
2427 void ExtensionService::FinishInstallation(const Extension* extension) { | 2427 void ExtensionService::FinishInstallation(const Extension* extension) { |
2428 bool is_update = GetInstalledExtension(extension->id()) != NULL; | 2428 const extensions::Extension* existing_extension = |
2429 extensions::InstalledExtensionInfo details(extension, is_update); | 2429 GetInstalledExtension(extension->id()); |
| 2430 bool is_update = false; |
| 2431 std::string old_name; |
| 2432 if (existing_extension) { |
| 2433 is_update = true; |
| 2434 old_name = existing_extension->name(); |
| 2435 } |
| 2436 extensions::InstalledExtensionInfo details(extension, is_update, old_name); |
2430 content::NotificationService::current()->Notify( | 2437 content::NotificationService::current()->Notify( |
2431 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 2438 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
2432 content::Source<Profile>(profile_), | 2439 content::Source<Profile>(profile_), |
2433 content::Details<const extensions::InstalledExtensionInfo>(&details)); | 2440 content::Details<const extensions::InstalledExtensionInfo>(&details)); |
2434 | 2441 |
2435 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); | 2442 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); |
2436 | 2443 |
2437 // Unpacked extensions default to allowing file access, but if that has been | 2444 // Unpacked extensions default to allowing file access, but if that has been |
2438 // overridden, don't reset the value. | 2445 // overridden, don't reset the value. |
2439 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && | 2446 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3102 } | 3109 } |
3103 | 3110 |
3104 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3111 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3105 update_observers_.AddObserver(observer); | 3112 update_observers_.AddObserver(observer); |
3106 } | 3113 } |
3107 | 3114 |
3108 void ExtensionService::RemoveUpdateObserver( | 3115 void ExtensionService::RemoveUpdateObserver( |
3109 extensions::UpdateObserver* observer) { | 3116 extensions::UpdateObserver* observer) { |
3110 update_observers_.RemoveObserver(observer); | 3117 update_observers_.RemoveObserver(observer); |
3111 } | 3118 } |
OLD | NEW |