OLD | NEW |
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 "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <objidl.h> | 8 #include <objidl.h> |
9 #include <mlang.h> | 9 #include <mlang.h> |
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 FilePath WebStringToFilePath(const WebString& str) { | 318 FilePath WebStringToFilePath(const WebString& str) { |
319 return FilePath(WebStringToFilePathString(str)); | 319 return FilePath(WebStringToFilePathString(str)); |
320 } | 320 } |
321 | 321 |
322 WebString FilePathToWebString(const FilePath& file_path) { | 322 WebString FilePathToWebString(const FilePath& file_path) { |
323 return FilePathStringToWebString(file_path.value()); | 323 return FilePathStringToWebString(file_path.value()); |
324 } | 324 } |
325 | 325 |
326 WebKit::WebFileError PlatformFileErrorToWebFileError( | |
327 base::PlatformFileError error_code) { | |
328 switch (error_code) { | |
329 case base::PLATFORM_FILE_ERROR_NOT_FOUND: | |
330 return WebKit::WebFileErrorNotFound; | |
331 case base::PLATFORM_FILE_ERROR_INVALID_OPERATION: | |
332 case base::PLATFORM_FILE_ERROR_EXISTS: | |
333 case base::PLATFORM_FILE_ERROR_NOT_EMPTY: | |
334 return WebKit::WebFileErrorInvalidModification; | |
335 case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY: | |
336 case base::PLATFORM_FILE_ERROR_NOT_A_FILE: | |
337 return WebKit::WebFileErrorTypeMismatch; | |
338 case base::PLATFORM_FILE_ERROR_ACCESS_DENIED: | |
339 return WebKit::WebFileErrorNoModificationAllowed; | |
340 case base::PLATFORM_FILE_ERROR_FAILED: | |
341 return WebKit::WebFileErrorInvalidState; | |
342 case base::PLATFORM_FILE_ERROR_ABORT: | |
343 return WebKit::WebFileErrorAbort; | |
344 case base::PLATFORM_FILE_ERROR_SECURITY: | |
345 return WebKit::WebFileErrorSecurity; | |
346 case base::PLATFORM_FILE_ERROR_NO_SPACE: | |
347 return WebKit::WebFileErrorQuotaExceeded; | |
348 default: | |
349 return WebKit::WebFileErrorInvalidModification; | |
350 } | |
351 } | |
352 | |
353 void PlatformFileInfoToWebFileInfo( | 326 void PlatformFileInfoToWebFileInfo( |
354 const base::PlatformFileInfo& file_info, | 327 const base::PlatformFileInfo& file_info, |
355 WebKit::WebFileInfo* web_file_info) { | 328 WebKit::WebFileInfo* web_file_info) { |
356 DCHECK(web_file_info); | 329 DCHECK(web_file_info); |
357 web_file_info->modificationTime = file_info.last_modified.ToDoubleT(); | 330 web_file_info->modificationTime = file_info.last_modified.ToDoubleT(); |
358 web_file_info->length = file_info.size; | 331 web_file_info->length = file_info.size; |
359 if (file_info.is_directory) | 332 if (file_info.is_directory) |
360 web_file_info->type = WebKit::WebFileInfo::TypeDirectory; | 333 web_file_info->type = WebKit::WebFileInfo::TypeDirectory; |
361 else | 334 else |
362 web_file_info->type = WebKit::WebFileInfo::TypeFile; | 335 web_file_info->type = WebKit::WebFileInfo::TypeFile; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 case WebKit::WebReferrerPolicyAlways: | 502 case WebKit::WebReferrerPolicyAlways: |
530 case WebKit::WebReferrerPolicyNever: | 503 case WebKit::WebReferrerPolicyNever: |
531 case WebKit::WebReferrerPolicyOrigin: | 504 case WebKit::WebReferrerPolicyOrigin: |
532 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; | 505 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; |
533 break; | 506 break; |
534 } | 507 } |
535 request->set_referrer_policy(net_referrer_policy); | 508 request->set_referrer_policy(net_referrer_policy); |
536 } | 509 } |
537 | 510 |
538 } // namespace webkit_glue | 511 } // namespace webkit_glue |
OLD | NEW |