| 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/extension_file_util.h" | 5 #include "chrome/browser/extensions/extension_file_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 *error = "Couldn't create CurrentVersion file."; | 73 *error = "Couldn't create CurrentVersion file."; |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ReadCurrentVersion(const FilePath& dir, std::string* version_string) { | 79 bool ReadCurrentVersion(const FilePath& dir, std::string* version_string) { |
| 80 FilePath current_version = dir.AppendASCII(kCurrentVersionFileName); | 80 FilePath current_version = dir.AppendASCII(kCurrentVersionFileName); |
| 81 if (file_util::PathExists(current_version)) { | 81 if (file_util::PathExists(current_version)) { |
| 82 if (file_util::ReadFileToString(current_version, version_string)) { | 82 if (file_util::ReadFileToString(current_version, version_string)) { |
| 83 TrimWhitespace(*version_string, TRIM_ALL, version_string); | 83 TrimWhitespaceASCII(*version_string, TRIM_ALL, version_string); |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 Extension::InstallType CompareToInstalledVersion( | 90 Extension::InstallType CompareToInstalledVersion( |
| 91 const FilePath& install_directory, const std::string& id, | 91 const FilePath& install_directory, const std::string& id, |
| 92 const std::string& new_version_str, std::string *current_version_str) { | 92 const std::string& new_version_str, std::string *current_version_str) { |
| 93 CHECK(current_version_str); | 93 CHECK(current_version_str); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 "directory: " << extension_id; | 343 "directory: " << extension_id; |
| 344 LOG(INFO) << "Deleting invalid extension directory " | 344 LOG(INFO) << "Deleting invalid extension directory " |
| 345 << WideToASCII(extension_path.ToWStringHack()) << "."; | 345 << WideToASCII(extension_path.ToWStringHack()) << "."; |
| 346 file_util::Delete(extension_path, true); // Recursive. | 346 file_util::Delete(extension_path, true); // Recursive. |
| 347 continue; | 347 continue; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // extensionfile_util | 352 } // extensionfile_util |
| OLD | NEW |