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

Side by Side Diff: chrome/browser/extensions/sandboxed_unpacker.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | 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/browser/extensions/sandboxed_unpacker.h" 5 #include "chrome/browser/extensions/sandboxed_unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool normalized = 134 bool normalized =
135 file_util::NormalizeFilePath(temp_file, &normalized_temp_file); 135 file_util::NormalizeFilePath(temp_file, &normalized_temp_file);
136 if (!normalized) { 136 if (!normalized) {
137 // If |temp_file| contains a link, the sandbox will block al file system 137 // If |temp_file| contains a link, the sandbox will block al file system
138 // operations, and the install will fail. 138 // operations, and the install will fail.
139 LOG(ERROR) << temp_dir->value() << " seem to be on remote drive."; 139 LOG(ERROR) << temp_dir->value() << " seem to be on remote drive.";
140 } else { 140 } else {
141 *temp_dir = normalized_temp_file.DirName(); 141 *temp_dir = normalized_temp_file.DirName();
142 } 142 }
143 // Clean up the temp file. 143 // Clean up the temp file.
144 file_util::Delete(temp_file, false); 144 base::Delete(temp_file, false);
145 145
146 return normalized; 146 return normalized;
147 } 147 }
148 148
149 // This function tries to find a location for unpacking the extension archive 149 // This function tries to find a location for unpacking the extension archive
150 // that is writable and does not lie on a shared drive so that the sandboxed 150 // that is writable and does not lie on a shared drive so that the sandboxed
151 // unpacking process can write there. If no such location exists we can not 151 // unpacking process can write there. If no such location exists we can not
152 // proceed and should fail. 152 // proceed and should fail.
153 // The result will be written to |temp_dir|. The function will write to this 153 // The result will be written to |temp_dir|. The function will write to this
154 // parameter even if it returns false. 154 // parameter even if it returns false.
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 base::FilePath path = *it; 654 base::FilePath path = *it;
655 if (path.IsAbsolute() || path.ReferencesParent()) { 655 if (path.IsAbsolute() || path.ReferencesParent()) {
656 // Invalid path for browser image. 656 // Invalid path for browser image.
657 ReportFailure( 657 ReportFailure(
658 INVALID_PATH_FOR_BROWSER_IMAGE, 658 INVALID_PATH_FOR_BROWSER_IMAGE,
659 l10n_util::GetStringFUTF16( 659 l10n_util::GetStringFUTF16(
660 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 660 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
661 ASCIIToUTF16("INVALID_PATH_FOR_BROWSER_IMAGE"))); 661 ASCIIToUTF16("INVALID_PATH_FOR_BROWSER_IMAGE")));
662 return false; 662 return false;
663 } 663 }
664 if (!file_util::Delete(extension_root_.Append(path), false)) { 664 if (!base::Delete(extension_root_.Append(path), false)) {
665 // Error removing old image file. 665 // Error removing old image file.
666 ReportFailure( 666 ReportFailure(
667 ERROR_REMOVING_OLD_IMAGE_FILE, 667 ERROR_REMOVING_OLD_IMAGE_FILE,
668 l10n_util::GetStringFUTF16( 668 l10n_util::GetStringFUTF16(
669 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 669 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
670 ASCIIToUTF16("ERROR_REMOVING_OLD_IMAGE_FILE"))); 670 ASCIIToUTF16("ERROR_REMOVING_OLD_IMAGE_FILE")));
671 return false; 671 return false;
672 } 672 }
673 } 673 }
674 674
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 void SandboxedUnpacker::Cleanup() { 793 void SandboxedUnpacker::Cleanup() {
794 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); 794 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread());
795 if (!temp_dir_.Delete()) { 795 if (!temp_dir_.Delete()) {
796 LOG(WARNING) << "Can not delete temp directory at " 796 LOG(WARNING) << "Can not delete temp directory at "
797 << temp_dir_.path().value(); 797 << temp_dir_.path().value();
798 } 798 }
799 } 799 }
800 800
801 } // namespace extensions 801 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_startup_browsertest.cc ('k') | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698