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
3 // found in the LICENSE file.
5 #include "webkit/glue/webkit_glue.h"
7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebFileInfo.h"
9 #include "v8/include/v8.h"
11 namespace webkit_glue
{
13 void SetJavaScriptFlags(const std::string
& str
) {
14 v8::V8::SetFlagsFromString(str
.data(), static_cast<int>(str
.size()));
17 void PlatformFileInfoToWebFileInfo(
18 const base::PlatformFileInfo
& file_info
,
19 blink::WebFileInfo
* web_file_info
) {
20 DCHECK(web_file_info
);
21 // WebKit now expects NaN as uninitialized/null Date.
22 if (file_info
.last_modified
.is_null())
23 web_file_info
->modificationTime
= std::numeric_limits
<double>::quiet_NaN();
25 web_file_info
->modificationTime
= file_info
.last_modified
.ToDoubleT();
26 web_file_info
->length
= file_info
.size
;
27 if (file_info
.is_directory
)
28 web_file_info
->type
= blink::WebFileInfo::TypeDirectory
;
30 web_file_info
->type
= blink::WebFileInfo::TypeFile
;
33 COMPILE_ASSERT(std::numeric_limits
<double>::has_quiet_NaN
, has_quiet_NaN
);
35 } // namespace webkit_glue