summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_paths.cc6
-rw-r--r--chrome/common/chrome_paths.h4
-rw-r--r--chrome/common/extensions/extension_constants.cc11
-rw-r--r--chrome/common/extensions/extension_constants.h13
-rw-r--r--chrome/common/extensions/extension_file_util.h2
-rw-r--r--chrome/common/extensions/extension_unpacker.cc23
6 files changed, 43 insertions, 16 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index eccb65b..aefcebc 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -186,6 +186,12 @@ bool PathProvider(int key, FilePath* result) {
cur = cur.Append(FILE_PATH_LITERAL("Dictionaries"));
create_dir = true;
break;
+ case chrome::DIR_USER_DATA_TEMP:
+ if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
+ return false;
+ cur = cur.Append(FILE_PATH_LITERAL("Temp"));
+ create_dir = true;
+ break;
case chrome::FILE_LOCAL_STATE:
if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
return false;
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index c5e13d2..9ed8057 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -32,6 +32,10 @@ enum {
DIR_DEFAULT_DOWNLOADS_SAFE, // Directory for a user's
// "My Documents/Downloads".
DIR_DEFAULT_DOWNLOADS, // Directory for a user's downloads.
+ DIR_USER_DATA_TEMP, // A temp directory within DIR_USER_DATA. Use
+ // this when a temporary file or directory will
+ // be moved into the profile, to avoid issues
+ // moving across volumes. See crbug.com/13044 .
FILE_RESOURCE_MODULE, // Full path and filename of the module that
// contains embedded resources (version,
// strings, images, etc.).
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index 1db05cb..174701c 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -253,3 +253,14 @@ const char* kGalleryDownloadPrefix =
const char* kMiniGalleryBrowsePrefix = "https://tools.google.com/chrome/";
const char* kMiniGalleryDownloadPrefix = "https://dl-ssl.google.com/chrome/";
}
+
+namespace extension_filenames {
+const char* kTempExtensionName = "CRX_INSTALL";
+
+// The file to write our decoded images to, relative to the extension_path.
+const char* kDecodedImagesFilename = "DECODED_IMAGES";
+
+// The file to write our decoded message catalogs to, relative to the
+// extension_path.
+const char* kDecodedMessageCatalogsFilename = "DECODED_MESSAGE_CATALOGS";
+}
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index 1b1e798..36ba762 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -175,4 +175,17 @@ namespace extension_urls {
extern const char* kMiniGalleryDownloadPrefix;
} // namespace extension_urls
+namespace extension_filenames {
+ // The name of a temporary directory to install an extension into for
+ // validation before finalizing install.
+ extern const char* kTempExtensionName;
+
+ // The file to write our decoded images to, relative to the extension_path.
+ extern const char* kDecodedImagesFilename;
+
+ // The file to write our decoded message catalogs to, relative to the
+ // extension_path.
+ extern const char* kDecodedMessageCatalogsFilename;
+}
+
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
diff --git a/chrome/common/extensions/extension_file_util.h b/chrome/common/extensions/extension_file_util.h
index b711df0..dc6a5bd 100644
--- a/chrome/common/extensions/extension_file_util.h
+++ b/chrome/common/extensions/extension_file_util.h
@@ -25,7 +25,7 @@ extern const char kInstallDirectoryName[];
extern const char kCurrentVersionFileName[];
// Move source_dir to dest_dir (it will actually be named dest_dir, not inside
-// dest_dir). If the parent path doesn't exixt, create it. If something else is
+// dest_dir). If the parent path doesn't exist, create it. If something else is
// already there, remove it.
bool MoveDirSafely(const FilePath& source_dir, const FilePath& dest_dir);
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index dad10f4..8c634e2 100644
--- a/chrome/common/extensions/extension_unpacker.cc
+++ b/chrome/common/extensions/extension_unpacker.cc
@@ -26,18 +26,9 @@
namespace errors = extension_manifest_errors;
namespace keys = extension_manifest_keys;
+namespace filenames = extension_filenames;
namespace {
-// The name of a temporary directory to install an extension into for
-// validation before finalizing install.
-const char kTempExtensionName[] = "TEMP_INSTALL";
-
-// The file to write our decoded images to, relative to the extension_path.
-const char kDecodedImagesFilename[] = "DECODED_IMAGES";
-
-// The file to write our decoded message catalogs to, relative to the
-// extension_path.
-const char kDecodedMessageCatalogsFilename[] = "DECODED_MESSAGE_CATALOGS";
// Errors
const char* kCouldNotCreateDirectoryError =
@@ -148,7 +139,7 @@ bool ExtensionUnpacker::Run() {
// <profile>/Extensions/INSTALL_TEMP/<version>
temp_install_dir_ =
- extension_path_.DirName().AppendASCII(kTempExtensionName);
+ extension_path_.DirName().AppendASCII(filenames::kTempExtensionName);
if (!file_util::CreateDirectory(temp_install_dir_)) {
#if defined(OS_WIN)
std::string dir_string = WideToUTF8(temp_install_dir_.value());
@@ -209,7 +200,8 @@ bool ExtensionUnpacker::DumpImagesToFile() {
IPC::Message pickle; // We use a Message so we can use WriteParam.
IPC::WriteParam(&pickle, decoded_images_);
- FilePath path = extension_path_.DirName().AppendASCII(kDecodedImagesFilename);
+ FilePath path = extension_path_.DirName().AppendASCII(
+ filenames::kDecodedImagesFilename);
if (!file_util::WriteFile(path, static_cast<const char*>(pickle.data()),
pickle.size())) {
SetError("Could not write image data to disk.");
@@ -224,7 +216,7 @@ bool ExtensionUnpacker::DumpMessageCatalogsToFile() {
IPC::WriteParam(&pickle, *parsed_catalogs_.get());
FilePath path = extension_path_.DirName().AppendASCII(
- kDecodedMessageCatalogsFilename);
+ filenames::kDecodedMessageCatalogsFilename);
if (!file_util::WriteFile(path, static_cast<const char*>(pickle.data()),
pickle.size())) {
SetError("Could not write message catalogs to disk.");
@@ -237,7 +229,7 @@ bool ExtensionUnpacker::DumpMessageCatalogsToFile() {
// static
bool ExtensionUnpacker::ReadImagesFromFile(const FilePath& extension_path,
DecodedImages* images) {
- FilePath path = extension_path.AppendASCII(kDecodedImagesFilename);
+ FilePath path = extension_path.AppendASCII(filenames::kDecodedImagesFilename);
std::string file_str;
if (!file_util::ReadFileToString(path, &file_str))
return false;
@@ -250,7 +242,8 @@ bool ExtensionUnpacker::ReadImagesFromFile(const FilePath& extension_path,
// static
bool ExtensionUnpacker::ReadMessageCatalogsFromFile(
const FilePath& extension_path, DictionaryValue* catalogs) {
- FilePath path = extension_path.AppendASCII(kDecodedMessageCatalogsFilename);
+ FilePath path = extension_path.AppendASCII(
+ filenames::kDecodedMessageCatalogsFilename);
std::string file_str;
if (!file_util::ReadFileToString(path, &file_str))
return false;