OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 extension = Extension::Create( | 1421 extension = Extension::Create( |
1422 info.extension_path, | 1422 info.extension_path, |
1423 info.extension_location, | 1423 info.extension_location, |
1424 *info.extension_manifest, | 1424 *info.extension_manifest, |
1425 flags, | 1425 flags, |
1426 &error); | 1426 &error); |
1427 } else { | 1427 } else { |
1428 error = errors::kManifestUnreadable; | 1428 error = errors::kManifestUnreadable; |
1429 } | 1429 } |
1430 | 1430 |
| 1431 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by |
| 1432 // updating the 'key' field in their manifest). |
| 1433 if (extension && |
| 1434 extension->location() != Extension::LOAD && |
| 1435 info.extension_id != extension->id()) { |
| 1436 error = errors::kCannotChangeExtensionID; |
| 1437 extension = NULL; |
| 1438 UserMetrics::RecordAction(UserMetricsAction("Extensions.IDChangedError")); |
| 1439 } |
| 1440 |
1431 if (!extension) { | 1441 if (!extension) { |
1432 ReportExtensionLoadError(info.extension_path, | 1442 ReportExtensionLoadError(info.extension_path, |
1433 error, | 1443 error, |
1434 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 1444 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
1435 false); | 1445 false); |
1436 return; | 1446 return; |
1437 } | 1447 } |
1438 | 1448 |
1439 if (write_to_prefs) | 1449 if (write_to_prefs) |
1440 extension_prefs_->UpdateManifest(extension); | 1450 extension_prefs_->UpdateManifest(extension); |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 | 2901 |
2892 ExtensionService::NaClModuleInfoList::iterator | 2902 ExtensionService::NaClModuleInfoList::iterator |
2893 ExtensionService::FindNaClModule(const GURL& url) { | 2903 ExtensionService::FindNaClModule(const GURL& url) { |
2894 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2904 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2895 iter != nacl_module_list_.end(); ++iter) { | 2905 iter != nacl_module_list_.end(); ++iter) { |
2896 if (iter->url == url) | 2906 if (iter->url == url) |
2897 return iter; | 2907 return iter; |
2898 } | 2908 } |
2899 return nacl_module_list_.end(); | 2909 return nacl_module_list_.end(); |
2900 } | 2910 } |
OLD | NEW |