OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/crypto/signature_verifier.h" | 9 #include "base/crypto/signature_verifier.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) { | 399 void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) { |
400 scoped_ptr<ExtensionList> cleanup(new_extensions); | 400 scoped_ptr<ExtensionList> cleanup(new_extensions); |
401 | 401 |
402 // Filter out any extensions that shouldn't be loaded. Themes are always | 402 // Filter out any extensions that shouldn't be loaded. Themes are always |
403 // loaded, but other extensions are only loaded if the extensions system is | 403 // loaded, but other extensions are only loaded if the extensions system is |
404 // enabled. | 404 // enabled. |
405 ExtensionList enabled_extensions; | 405 ExtensionList enabled_extensions; |
406 for (ExtensionList::iterator iter = new_extensions->begin(); | 406 for (ExtensionList::iterator iter = new_extensions->begin(); |
407 iter != new_extensions->end(); ++iter) { | 407 iter != new_extensions->end(); ++iter) { |
408 if (extensions_enabled() || (*iter)->IsTheme() || | 408 if (extensions_enabled() || (*iter)->IsTheme() || |
| 409 (*iter)->location() == Extension::LOAD || |
409 (*iter)->location() == Extension::EXTERNAL_REGISTRY) { | 410 (*iter)->location() == Extension::EXTERNAL_REGISTRY) { |
410 Extension* old = GetExtensionById((*iter)->id()); | 411 Extension* old = GetExtensionById((*iter)->id()); |
411 if (old) { | 412 if (old) { |
412 if ((*iter)->version()->CompareTo(*(old->version())) > 0) { | 413 if ((*iter)->version()->CompareTo(*(old->version())) > 0) { |
413 // To upgrade an extension in place, unload the old one and | 414 // To upgrade an extension in place, unload the old one and |
414 // then load the new one. | 415 // then load the new one. |
415 // TODO(erikkay) issue 12399 | 416 // TODO(erikkay) issue 12399 |
416 UnloadExtension(old->id()); | 417 UnloadExtension(old->id()); |
417 } else { | 418 } else { |
418 // We already have the extension of the same or older version. | 419 // We already have the extension of the same or older version. |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 Extension::InstallType install_type = | 1381 Extension::InstallType install_type = |
1381 CompareToInstalledVersion(id, version->GetString(), ¤t_version); | 1382 CompareToInstalledVersion(id, version->GetString(), ¤t_version); |
1382 | 1383 |
1383 if (install_type == Extension::DOWNGRADE) | 1384 if (install_type == Extension::DOWNGRADE) |
1384 return false; | 1385 return false; |
1385 | 1386 |
1386 return (install_type == Extension::UPGRADE || | 1387 return (install_type == Extension::UPGRADE || |
1387 install_type == Extension::NEW_INSTALL || | 1388 install_type == Extension::NEW_INSTALL || |
1388 NeedsReinstall(id, current_version)); | 1389 NeedsReinstall(id, current_version)); |
1389 } | 1390 } |
OLD | NEW |