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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 WideToUTF8(plugin.path.ToWStringHack()).c_str())); | 745 WideToUTF8(plugin.path.ToWStringHack()).c_str())); |
746 return NULL; | 746 return NULL; |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 // Validate icon location for page actions. | 750 // Validate icon location for page actions. |
751 const PageActionMap& page_actions = extension->page_actions(); | 751 const PageActionMap& page_actions = extension->page_actions(); |
752 for (PageActionMap::const_iterator i(page_actions.begin()); | 752 for (PageActionMap::const_iterator i(page_actions.begin()); |
753 i != page_actions.end(); ++i) { | 753 i != page_actions.end(); ++i) { |
754 PageAction* page_action = i->second; | 754 PageAction* page_action = i->second; |
755 FilePath path = page_action->icon_path(); | 755 const std::vector<FilePath>& icon_paths = page_action->icon_paths(); |
756 if (!file_util::PathExists(path)) { | 756 for (std::vector<FilePath>::const_iterator iter = icon_paths.begin(); |
757 ReportExtensionLoadError(extension_path, | 757 iter != icon_paths.end(); ++iter) { |
758 StringPrintf("Could not load icon '%s' for page action.", | 758 FilePath path = *iter; |
759 WideToUTF8(path.ToWStringHack()).c_str())); | 759 if (!file_util::PathExists(path)) { |
760 return NULL; | 760 ReportExtensionLoadError(extension_path, |
| 761 StringPrintf("Could not load icon '%s' for page action.", |
| 762 WideToUTF8(path.ToWStringHack()).c_str())); |
| 763 return NULL; |
| 764 } |
761 } | 765 } |
762 } | 766 } |
763 | 767 |
764 return extension.release(); | 768 return extension.release(); |
765 } | 769 } |
766 | 770 |
767 void ExtensionsServiceBackend::ReportExtensionLoadError( | 771 void ExtensionsServiceBackend::ReportExtensionLoadError( |
768 const FilePath& extension_path, const std::string &error) { | 772 const FilePath& extension_path, const std::string &error) { |
769 // TODO(port): note that this isn't guaranteed to work properly on Linux. | 773 // TODO(port): note that this isn't guaranteed to work properly on Linux. |
770 std::string path_str = WideToASCII(extension_path.ToWStringHack()); | 774 std::string path_str = WideToASCII(extension_path.ToWStringHack()); |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 Extension::InstallType install_type = | 1378 Extension::InstallType install_type = |
1375 CompareToInstalledVersion(id, version->GetString(), ¤t_version); | 1379 CompareToInstalledVersion(id, version->GetString(), ¤t_version); |
1376 | 1380 |
1377 if (install_type == Extension::DOWNGRADE) | 1381 if (install_type == Extension::DOWNGRADE) |
1378 return false; | 1382 return false; |
1379 | 1383 |
1380 return (install_type == Extension::UPGRADE || | 1384 return (install_type == Extension::UPGRADE || |
1381 install_type == Extension::NEW_INSTALL || | 1385 install_type == Extension::NEW_INSTALL || |
1382 NeedsReinstall(id, current_version)); | 1386 NeedsReinstall(id, current_version)); |
1383 } | 1387 } |
OLD | NEW |