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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc

Issue 100573002: Move directory creation 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 "content/browser/renderer_host/pepper/pepper_flash_file_message_filter. h" 5 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter. h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 int32_t PepperFlashFileMessageFilter::OnCreateDir( 187 int32_t PepperFlashFileMessageFilter::OnCreateDir(
188 ppapi::host::HostMessageContext* context, 188 ppapi::host::HostMessageContext* context,
189 const ppapi::PepperFilePath& path) { 189 const ppapi::PepperFilePath& path) {
190 base::FilePath full_path = ValidateAndConvertPepperFilePath( 190 base::FilePath full_path = ValidateAndConvertPepperFilePath(
191 path, base::Bind(&CanCreateReadWrite)); 191 path, base::Bind(&CanCreateReadWrite));
192 if (full_path.empty()) { 192 if (full_path.empty()) {
193 return ppapi::PlatformFileErrorToPepperError( 193 return ppapi::PlatformFileErrorToPepperError(
194 base::PLATFORM_FILE_ERROR_ACCESS_DENIED); 194 base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
195 } 195 }
196 196
197 bool result = file_util::CreateDirectory(full_path); 197 bool result = base::CreateDirectory(full_path);
198 return ppapi::PlatformFileErrorToPepperError(result ? 198 return ppapi::PlatformFileErrorToPepperError(result ?
199 base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED); 199 base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
200 } 200 }
201 201
202 int32_t PepperFlashFileMessageFilter::OnQueryFile( 202 int32_t PepperFlashFileMessageFilter::OnQueryFile(
203 ppapi::host::HostMessageContext* context, 203 ppapi::host::HostMessageContext* context,
204 const ppapi::PepperFilePath& path) { 204 const ppapi::PepperFilePath& path) {
205 base::FilePath full_path = ValidateAndConvertPepperFilePath( 205 base::FilePath full_path = ValidateAndConvertPepperFilePath(
206 path, base::Bind(&CanRead)); 206 path, base::Bind(&CanRead));
207 if (full_path.empty()) { 207 if (full_path.empty()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 int32_t PepperFlashFileMessageFilter::OnCreateTemporaryFile( 248 int32_t PepperFlashFileMessageFilter::OnCreateTemporaryFile(
249 ppapi::host::HostMessageContext* context) { 249 ppapi::host::HostMessageContext* context) {
250 ppapi::PepperFilePath dir_path( 250 ppapi::PepperFilePath dir_path(
251 ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, base::FilePath()); 251 ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, base::FilePath());
252 base::FilePath validated_dir_path = ValidateAndConvertPepperFilePath( 252 base::FilePath validated_dir_path = ValidateAndConvertPepperFilePath(
253 dir_path, base::Bind(&CanCreateReadWrite)); 253 dir_path, base::Bind(&CanCreateReadWrite));
254 if (validated_dir_path.empty() || 254 if (validated_dir_path.empty() ||
255 (!base::DirectoryExists(validated_dir_path) && 255 (!base::DirectoryExists(validated_dir_path) &&
256 !file_util::CreateDirectory(validated_dir_path))) { 256 !base::CreateDirectory(validated_dir_path))) {
257 return ppapi::PlatformFileErrorToPepperError( 257 return ppapi::PlatformFileErrorToPepperError(
258 base::PLATFORM_FILE_ERROR_ACCESS_DENIED); 258 base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
259 } 259 }
260 260
261 base::FilePath file_path; 261 base::FilePath file_path;
262 if (!base::CreateTemporaryFileInDir(validated_dir_path, &file_path)) { 262 if (!base::CreateTemporaryFileInDir(validated_dir_path, &file_path)) {
263 return ppapi::PlatformFileErrorToPepperError( 263 return ppapi::PlatformFileErrorToPepperError(
264 base::PLATFORM_FILE_ERROR_FAILED); 264 base::PLATFORM_FILE_ERROR_FAILED);
265 } 265 }
266 266
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 file_path = plugin_data_directory_.Append(pepper_path.path()); 307 file_path = plugin_data_directory_.Append(pepper_path.path());
308 break; 308 break;
309 default: 309 default:
310 NOTREACHED(); 310 NOTREACHED();
311 break; 311 break;
312 } 312 }
313 return file_path; 313 return file_path;
314 } 314 }
315 315
316 } // namespace content 316 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/net/sqlite_persistent_cookie_store.cc ('k') | content/browser/storage_partition_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698