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 "content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h
" | 5 #include "content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h
" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
10 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" | |
11 #include "content/common/indexed_db/indexed_db_key.h" | |
12 #include "content/common/indexed_db/indexed_db_key_path.h" | |
13 #include "content/public/common/serialized_script_value.h" | 10 #include "content/public/common/serialized_script_value.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
18 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
19 | 15 |
20 using content::IndexedDBKey; | |
21 using content::IndexedDBKeyPath; | |
22 using content::SerializedScriptValue; | |
23 | |
24 BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() { | 16 BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() { |
25 file_utilities_.set_sandbox_enabled(false); | 17 file_utilities_.set_sandbox_enabled(false); |
26 } | 18 } |
27 | 19 |
28 BrowserWebKitPlatformSupportImpl::~BrowserWebKitPlatformSupportImpl() { | 20 BrowserWebKitPlatformSupportImpl::~BrowserWebKitPlatformSupportImpl() { |
29 } | 21 } |
30 | 22 |
31 WebKit::WebClipboard* BrowserWebKitPlatformSupportImpl::clipboard() { | 23 WebKit::WebClipboard* BrowserWebKitPlatformSupportImpl::clipboard() { |
32 NOTREACHED(); | 24 NOTREACHED(); |
33 return NULL; | 25 return NULL; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 NOTREACHED(); | 117 NOTREACHED(); |
126 return NULL; | 118 return NULL; |
127 } | 119 } |
128 | 120 |
129 int BrowserWebKitPlatformSupportImpl::databaseDeleteFile( | 121 int BrowserWebKitPlatformSupportImpl::databaseDeleteFile( |
130 const WebKit::WebString& vfs_file_name, bool sync_dir) { | 122 const WebKit::WebString& vfs_file_name, bool sync_dir) { |
131 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); | 123 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); |
132 return file_util::Delete(path, false) ? 0 : 1; | 124 return file_util::Delete(path, false) ? 0 : 1; |
133 } | 125 } |
134 | 126 |
135 void | |
136 BrowserWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( | |
137 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, | |
138 const WebKit::WebIDBKeyPath& keyPath, | |
139 WebKit::WebVector<WebKit::WebIDBKey>& keys) { | |
140 | |
141 std::vector<SerializedScriptValue> std_values; | |
142 size_t size = values.size(); | |
143 std_values.reserve(size); | |
144 for (size_t i = 0; i < size; ++i) | |
145 std_values.push_back(SerializedScriptValue(values[i])); | |
146 | |
147 std::vector<IndexedDBKey> std_keys; | |
148 IndexedDBKeyUtilityClient:: | |
149 CreateIDBKeysFromSerializedValuesAndKeyPath( | |
150 std_values, IndexedDBKeyPath(keyPath), &std_keys); | |
151 | |
152 keys = std_keys; | |
153 } | |
154 | |
155 WebKit::WebSerializedScriptValue | |
156 BrowserWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( | |
157 const WebKit::WebIDBKey& key, const WebKit::WebSerializedScriptValue& value, | |
158 const WebKit::WebIDBKeyPath& keyPath) { | |
159 return IndexedDBKeyUtilityClient::InjectIDBKeyIntoSerializedValue( | |
160 IndexedDBKey(key), SerializedScriptValue(value), | |
161 IndexedDBKeyPath(keyPath)); | |
162 } | |
163 | |
164 GpuChannelHostFactory* | 127 GpuChannelHostFactory* |
165 BrowserWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 128 BrowserWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
166 return content::BrowserGpuChannelHostFactory::instance(); | 129 return content::BrowserGpuChannelHostFactory::instance(); |
167 } | 130 } |
OLD | NEW |