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

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

Issue 2714016: If CreateDirectory() fails during extension unpacking, log the exact OS call that failed. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Rebase for commit. Created 10 years, 6 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 unified diff | Download patch
« no previous file with comments | « base/file_util_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_unpacker.h" 5 #include "chrome/common/extensions/extension_unpacker.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/scoped_handle.h" 8 #include "base/scoped_handle.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 return true; 134 return true;
135 } 135 }
136 136
137 bool ExtensionUnpacker::Run() { 137 bool ExtensionUnpacker::Run() {
138 LOG(INFO) << "Installing extension " << extension_path_.value(); 138 LOG(INFO) << "Installing extension " << extension_path_.value();
139 139
140 // <profile>/Extensions/INSTALL_TEMP/<version> 140 // <profile>/Extensions/INSTALL_TEMP/<version>
141 temp_install_dir_ = 141 temp_install_dir_ =
142 extension_path_.DirName().AppendASCII(filenames::kTempExtensionName); 142 extension_path_.DirName().AppendASCII(filenames::kTempExtensionName);
143
144 #if defined(OS_WIN)
145 std::ostringstream log_stream;
146 std::string dir_string = WideToUTF8(temp_install_dir_.value());
147 log_stream << kCouldNotCreateDirectoryError << dir_string << std::endl;
148 if (!file_util::CreateDirectoryExtraLogging(temp_install_dir_, log_stream)) {
149 log_stream.flush();
150 SetError(log_stream.str());
151 return false;
152 }
153 #else
143 if (!file_util::CreateDirectory(temp_install_dir_)) { 154 if (!file_util::CreateDirectory(temp_install_dir_)) {
144 #if defined(OS_WIN)
145 std::string dir_string = WideToUTF8(temp_install_dir_.value());
146 #else
147 std::string dir_string = temp_install_dir_.value(); 155 std::string dir_string = temp_install_dir_.value();
148 #endif
149 SetError(kCouldNotCreateDirectoryError + dir_string); 156 SetError(kCouldNotCreateDirectoryError + dir_string);
150 return false; 157 return false;
151 } 158 }
159 #endif
152 160
153 if (!Unzip(extension_path_, temp_install_dir_)) { 161 if (!Unzip(extension_path_, temp_install_dir_)) {
154 SetError(kCouldNotUnzipExtension); 162 SetError(kCouldNotUnzipExtension);
155 return false; 163 return false;
156 } 164 }
157 165
158 // Parse the manifest. 166 // Parse the manifest.
159 parsed_manifest_.reset(ReadManifest()); 167 parsed_manifest_.reset(ReadManifest());
160 if (!parsed_manifest_.get()) 168 if (!parsed_manifest_.get())
161 return false; // Error was already reported. 169 return false; // Error was already reported.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 302
295 parsed_catalogs_->Set(relative_path.DirName().ToWStringHack(), 303 parsed_catalogs_->Set(relative_path.DirName().ToWStringHack(),
296 root.release()); 304 root.release());
297 305
298 return true; 306 return true;
299 } 307 }
300 308
301 void ExtensionUnpacker::SetError(const std::string &error) { 309 void ExtensionUnpacker::SetError(const std::string &error) {
302 error_message_ = error; 310 error_message_ = error;
303 } 311 }
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698