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