Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: chrome/common/extensions/extension_file_util.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/scoped_temp_dir.h"
12 #include "base/json/json_file_value_serializer.h" 13 #include "base/json/json_file_value_serializer.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/scoped_temp_dir.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_l10n_util.h" 23 #include "chrome/common/extensions/extension_l10n_util.h"
24 #include "chrome/common/extensions/extension_manifest_constants.h" 24 #include "chrome/common/extensions/extension_manifest_constants.h"
25 #include "chrome/common/extensions/extension_messages.h" 25 #include "chrome/common/extensions/extension_messages.h"
26 #include "chrome/common/extensions/extension_resource.h" 26 #include "chrome/common/extensions/extension_resource.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 FilePath version_dir; 76 FilePath version_dir;
77 77
78 // Create the extension directory if it doesn't exist already. 78 // Create the extension directory if it doesn't exist already.
79 if (!file_util::PathExists(extension_dir)) { 79 if (!file_util::PathExists(extension_dir)) {
80 if (!file_util::CreateDirectory(extension_dir)) 80 if (!file_util::CreateDirectory(extension_dir))
81 return FilePath(); 81 return FilePath();
82 } 82 }
83 83
84 // Get a temp directory on the same file system as the profile. 84 // Get a temp directory on the same file system as the profile.
85 FilePath install_temp_dir = GetInstallTempDir(extensions_dir); 85 FilePath install_temp_dir = GetInstallTempDir(extensions_dir);
86 ScopedTempDir extension_temp_dir; 86 base::ScopedTempDir extension_temp_dir;
87 if (install_temp_dir.empty() || 87 if (install_temp_dir.empty() ||
88 !extension_temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) { 88 !extension_temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) {
89 LOG(ERROR) << "Creating of temp dir under in the profile failed."; 89 LOG(ERROR) << "Creating of temp dir under in the profile failed.";
90 return FilePath(); 90 return FilePath();
91 } 91 }
92 FilePath crx_temp_source = 92 FilePath crx_temp_source =
93 extension_temp_dir.path().Append(unpacked_source_dir.BaseName()); 93 extension_temp_dir.path().Append(unpacked_source_dir.BaseName());
94 if (!file_util::Move(unpacked_source_dir, crx_temp_source)) { 94 if (!file_util::Move(unpacked_source_dir, crx_temp_source)) {
95 LOG(ERROR) << "Moving extension from : " << unpacked_source_dir.value() 95 LOG(ERROR) << "Moving extension from : " << unpacked_source_dir.value()
96 << " to : " << crx_temp_source.value() << " failed."; 96 << " to : " << crx_temp_source.value() << " failed.";
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 return FilePath(); 753 return FilePath();
754 } 754 }
755 return temp_path; 755 return temp_path;
756 } 756 }
757 757
758 void DeleteFile(const FilePath& path, bool recursive) { 758 void DeleteFile(const FilePath& path, bool recursive) {
759 file_util::Delete(path, recursive); 759 file_util::Delete(path, recursive);
760 } 760 }
761 761
762 } // namespace extension_file_util 762 } // namespace extension_file_util
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_intents_table_unittest.cc ('k') | chrome/common/extensions/extension_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698