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 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2420 CHECK(extension); | 2420 CHECK(extension); |
2421 delayed_updates_for_idle_.Remove(extension_id); | 2421 delayed_updates_for_idle_.Remove(extension_id); |
2422 | 2422 |
2423 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) | 2423 if (!extension_prefs_->FinishDelayedInstallInfo(extension_id)) |
2424 NOTREACHED(); | 2424 NOTREACHED(); |
2425 | 2425 |
2426 FinishInstallation(extension); | 2426 FinishInstallation(extension); |
2427 } | 2427 } |
2428 | 2428 |
2429 void ExtensionService::FinishInstallation(const Extension* extension) { | 2429 void ExtensionService::FinishInstallation(const Extension* extension) { |
2430 bool is_update = GetInstalledExtension(extension->id()) != NULL; | 2430 const extensions::Extension* existing_extension = |
2431 extensions::InstalledExtensionInfo details(extension, is_update); | 2431 GetInstalledExtension(extension->id()); |
2432 bool is_update = false; | |
2433 std::string old_name; | |
2434 if (existing_extension != NULL) { | |
koz (OOO until 15th September)
2013/05/17 01:36:19
nit: Just "if (existing_extension) {". It's cleane
Matt Giuca
2013/05/20 01:02:46
Done.
| |
2435 is_update = true; | |
2436 old_name = existing_extension->name(); | |
2437 } | |
2438 extensions::InstalledExtensionInfo details(extension, is_update, old_name); | |
2432 content::NotificationService::current()->Notify( | 2439 content::NotificationService::current()->Notify( |
2433 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 2440 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
2434 content::Source<Profile>(profile_), | 2441 content::Source<Profile>(profile_), |
2435 content::Details<const extensions::InstalledExtensionInfo>(&details)); | 2442 content::Details<const extensions::InstalledExtensionInfo>(&details)); |
2436 | 2443 |
2437 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); | 2444 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); |
2438 | 2445 |
2439 // Unpacked extensions default to allowing file access, but if that has been | 2446 // Unpacked extensions default to allowing file access, but if that has been |
2440 // overridden, don't reset the value. | 2447 // overridden, don't reset the value. |
2441 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && | 2448 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3111 } | 3118 } |
3112 | 3119 |
3113 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3120 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3114 update_observers_.AddObserver(observer); | 3121 update_observers_.AddObserver(observer); |
3115 } | 3122 } |
3116 | 3123 |
3117 void ExtensionService::RemoveUpdateObserver( | 3124 void ExtensionService::RemoveUpdateObserver( |
3118 extensions::UpdateObserver* observer) { | 3125 extensions::UpdateObserver* observer) { |
3119 update_observers_.RemoveObserver(observer); | 3126 update_observers_.RemoveObserver(observer); |
3120 } | 3127 } |
OLD | NEW |