| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/platform_file.h" |
| 8 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 9 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
| 9 #include "v8/include/v8.h" | |
| 10 | 10 |
| 11 namespace webkit_glue { | 11 namespace webkit_glue { |
| 12 | 12 |
| 13 void SetJavaScriptFlags(const std::string& str) { | |
| 14 v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); | |
| 15 } | |
| 16 | |
| 17 void FileInfoToWebFileInfo( | 13 void FileInfoToWebFileInfo( |
| 18 const base::File::Info& file_info, | 14 const base::File::Info& file_info, |
| 19 blink::WebFileInfo* web_file_info) { | 15 blink::WebFileInfo* web_file_info) { |
| 20 DCHECK(web_file_info); | 16 DCHECK(web_file_info); |
| 21 // WebKit now expects NaN as uninitialized/null Date. | 17 // WebKit now expects NaN as uninitialized/null Date. |
| 22 if (file_info.last_modified.is_null()) | 18 if (file_info.last_modified.is_null()) |
| 23 web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN(); | 19 web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN(); |
| 24 else | 20 else |
| 25 web_file_info->modificationTime = file_info.last_modified.ToDoubleT(); | 21 web_file_info->modificationTime = file_info.last_modified.ToDoubleT(); |
| 26 web_file_info->length = file_info.size; | 22 web_file_info->length = file_info.size; |
| 27 if (file_info.is_directory) | 23 if (file_info.is_directory) |
| 28 web_file_info->type = blink::WebFileInfo::TypeDirectory; | 24 web_file_info->type = blink::WebFileInfo::TypeDirectory; |
| 29 else | 25 else |
| 30 web_file_info->type = blink::WebFileInfo::TypeFile; | 26 web_file_info->type = blink::WebFileInfo::TypeFile; |
| 31 } | 27 } |
| 32 | 28 |
| 33 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); | 29 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); |
| 34 | 30 |
| 35 } // namespace webkit_glue | 31 } // namespace webkit_glue |
| OLD | NEW |