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

Unified Diff: chrome/common/extensions/extension_unpacker.cc

Issue 1582022: Unpack extensions inside chrome's directory. (Closed)
Patch Set: Final rebase. Created 10 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension_file_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_unpacker.cc
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index dad10f4c5836b01aaedb3468dc78cb598ccf4b0f..8c634e2101f2177ead0ce1f57198dd5195c3efef 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;
« no previous file with comments | « chrome/common/extensions/extension_file_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698