summaryrefslogtreecommitdiffstats
path: root/base/scoped_temp_dir.cc
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 17:00:09 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 17:00:09 +0000
commitb0b3abd98a59384a83349c83a5ef9b14851816da (patch)
tree790628087c773280456dffae7cfb0ea8f744649f /base/scoped_temp_dir.cc
parentec2717e405abc8f618133fe3c9f5051fff224e71 (diff)
downloadchromium_src-b0b3abd98a59384a83349c83a5ef9b14851816da.zip
chromium_src-b0b3abd98a59384a83349c83a5ef9b14851816da.tar.gz
chromium_src-b0b3abd98a59384a83349c83a5ef9b14851816da.tar.bz2
Unpack extensions inside chrome's profile directory.
Other users of the temp directory will be altered in a subsequent CL. BUG=13044 TEST=SandboxedExtensionUnpackerTest.*, ScopedTempDir.UniqueTempDirUnderPath, FileUtilTest.CreateNewTempDirInDirTest, manual testing on win, linux, mac. Review URL: http://codereview.chromium.org/1582022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_temp_dir.cc')
-rw-r--r--base/scoped_temp_dir.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/base/scoped_temp_dir.cc b/base/scoped_temp_dir.cc
index 07fcfb7..c8ed9c6 100644
--- a/base/scoped_temp_dir.cc
+++ b/base/scoped_temp_dir.cc
@@ -26,6 +26,21 @@ bool ScopedTempDir::CreateUniqueTempDir() {
return true;
}
+bool ScopedTempDir::CreateUniqueTempDirUnderPath(const FilePath& base_path) {
+ // If |path| does not exist, create it.
+ if (!file_util::CreateDirectory(base_path))
+ return false;
+
+ // Create a new, uniquly named directory under |base_path|.
+ if (!file_util::CreateTemporaryDirInDir(
+ base_path,
+ FILE_PATH_LITERAL("scoped_dir_"),
+ &path_)) {
+ return false;
+ }
+ return true;
+}
+
bool ScopedTempDir::Set(const FilePath& path) {
DCHECK(path_.empty());
if (!file_util::DirectoryExists(path) &&