| 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/common/extensions/extension_file_util.h" | 5 #include "chrome/common/extensions/extension_file_util.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 error)); | 132 error)); |
| 133 if (!extension.get()) | 133 if (!extension.get()) |
| 134 return NULL; | 134 return NULL; |
| 135 | 135 |
| 136 if (!ValidateExtension(extension.get(), error)) | 136 if (!ValidateExtension(extension.get(), error)) |
| 137 return NULL; | 137 return NULL; |
| 138 | 138 |
| 139 return extension; | 139 return extension; |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool ValidateExtension(Extension* extension, std::string* error) { | 142 bool ValidateExtension(const Extension* extension, std::string* error) { |
| 143 // Validate icons exist. | 143 // Validate icons exist. |
| 144 for (ExtensionIconSet::IconMap::const_iterator iter = | 144 for (ExtensionIconSet::IconMap::const_iterator iter = |
| 145 extension->icons().map().begin(); | 145 extension->icons().map().begin(); |
| 146 iter != extension->icons().map().end(); | 146 iter != extension->icons().map().end(); |
| 147 ++iter) { | 147 ++iter) { |
| 148 const FilePath path = extension->GetResource(iter->second).GetFilePath(); | 148 const FilePath path = extension->GetResource(iter->second).GetFilePath(); |
| 149 if (!file_util::PathExists(path)) { | 149 if (!file_util::PathExists(path)) { |
| 150 *error = | 150 *error = |
| 151 l10n_util::GetStringFUTF8(IDS_EXTENSION_LOAD_ICON_FAILED, | 151 l10n_util::GetStringFUTF8(IDS_EXTENSION_LOAD_ICON_FAILED, |
| 152 UTF8ToUTF16(iter->second)); | 152 UTF8ToUTF16(iter->second)); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 return temp_path; | 614 return temp_path; |
| 615 | 615 |
| 616 return FilePath(); | 616 return FilePath(); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void DeleteFile(const FilePath& path, bool recursive) { | 619 void DeleteFile(const FilePath& path, bool recursive) { |
| 620 file_util::Delete(path, recursive); | 620 file_util::Delete(path, recursive); |
| 621 } | 621 } |
| 622 | 622 |
| 623 } // namespace extension_file_util | 623 } // namespace extension_file_util |
| OLD | NEW |