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

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

Issue 99923002: Move temp file functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 } 118 }
119 119
120 // Work horse for FindWritableTempLocation. Creates a temp file in the folder 120 // Work horse for FindWritableTempLocation. Creates a temp file in the folder
121 // and uses NormalizeFilePath to check if the path is junction free. 121 // and uses NormalizeFilePath to check if the path is junction free.
122 bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) { 122 bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) {
123 if (temp_dir->empty()) 123 if (temp_dir->empty())
124 return false; 124 return false;
125 125
126 base::FilePath temp_file; 126 base::FilePath temp_file;
127 if (!file_util::CreateTemporaryFileInDir(*temp_dir, &temp_file)) { 127 if (!base::CreateTemporaryFileInDir(*temp_dir, &temp_file)) {
128 LOG(ERROR) << temp_dir->value() << " is not writable"; 128 LOG(ERROR) << temp_dir->value() << " is not writable";
129 return false; 129 return false;
130 } 130 }
131 // NormalizeFilePath requires a non-empty file, so write some data. 131 // NormalizeFilePath requires a non-empty file, so write some data.
132 // If you change the exit points of this function please make sure all 132 // If you change the exit points of this function please make sure all
133 // exit points delete this temp file! 133 // exit points delete this temp file!
134 if (file_util::WriteFile(temp_file, ".", 1) != 1) 134 if (file_util::WriteFile(temp_file, ".", 1) != 1)
135 return false; 135 return false;
136 136
137 base::FilePath normalized_temp_file; 137 base::FilePath normalized_temp_file;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 823
824 void SandboxedUnpacker::Cleanup() { 824 void SandboxedUnpacker::Cleanup() {
825 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); 825 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread());
826 if (!temp_dir_.Delete()) { 826 if (!temp_dir_.Delete()) {
827 LOG(WARNING) << "Can not delete temp directory at " 827 LOG(WARNING) << "Can not delete temp directory at "
828 << temp_dir_.path().value(); 828 << temp_dir_.path().value();
829 } 829 }
830 } 830 }
831 831
832 } // namespace extensions 832 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/feedback/feedback_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698