| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 700   std::string file_path = net::UnescapeURLComponent(url_path, | 700   std::string file_path = net::UnescapeURLComponent(url_path, | 
| 701       net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS); | 701       net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS); | 
| 702   size_t skip = file_path.find_first_not_of("/\\"); | 702   size_t skip = file_path.find_first_not_of("/\\"); | 
| 703   if (skip != file_path.npos) | 703   if (skip != file_path.npos) | 
| 704     file_path = file_path.substr(skip); | 704     file_path = file_path.substr(skip); | 
| 705 | 705 | 
| 706   base::FilePath path = | 706   base::FilePath path = | 
| 707 #if defined(OS_POSIX) | 707 #if defined(OS_POSIX) | 
| 708     base::FilePath(file_path); | 708     base::FilePath(file_path); | 
| 709 #elif defined(OS_WIN) | 709 #elif defined(OS_WIN) | 
| 710     base::FilePath(UTF8ToWide(file_path)); | 710     base::FilePath(base::UTF8ToWide(file_path)); | 
| 711 #else | 711 #else | 
| 712     base::FilePath(); | 712     base::FilePath(); | 
| 713     NOTIMPLEMENTED(); | 713     NOTIMPLEMENTED(); | 
| 714 #endif | 714 #endif | 
| 715 | 715 | 
| 716   // It's still possible for someone to construct an annoying URL whose path | 716   // It's still possible for someone to construct an annoying URL whose path | 
| 717   // would still wind up not being considered relative at this point. | 717   // would still wind up not being considered relative at this point. | 
| 718   // For example: chrome-extension://id/c:////foo.html | 718   // For example: chrome-extension://id/c:////foo.html | 
| 719   if (path.IsAbsolute()) | 719   if (path.IsAbsolute()) | 
| 720     return base::FilePath(); | 720     return base::FilePath(); | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 772     return base::FilePath(); | 772     return base::FilePath(); | 
| 773   } | 773   } | 
| 774   return temp_path; | 774   return temp_path; | 
| 775 } | 775 } | 
| 776 | 776 | 
| 777 void DeleteFile(const base::FilePath& path, bool recursive) { | 777 void DeleteFile(const base::FilePath& path, bool recursive) { | 
| 778   file_util::Delete(path, recursive); | 778   file_util::Delete(path, recursive); | 
| 779 } | 779 } | 
| 780 | 780 | 
| 781 }  // namespace extension_file_util | 781 }  // namespace extension_file_util | 
| OLD | NEW | 
|---|