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" |
10 #include "content/public/common/serialized_script_value.h" | 13 #include "content/public/common/serialized_script_value.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
14 #include "webkit/glue/webkit_glue.h" | 18 #include "webkit/glue/webkit_glue.h" |
15 | 19 |
| 20 using content::IndexedDBKey; |
| 21 using content::IndexedDBKeyPath; |
| 22 using content::SerializedScriptValue; |
| 23 |
16 BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() { | 24 BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() { |
17 file_utilities_.set_sandbox_enabled(false); | 25 file_utilities_.set_sandbox_enabled(false); |
18 } | 26 } |
19 | 27 |
20 BrowserWebKitPlatformSupportImpl::~BrowserWebKitPlatformSupportImpl() { | 28 BrowserWebKitPlatformSupportImpl::~BrowserWebKitPlatformSupportImpl() { |
21 } | 29 } |
22 | 30 |
23 WebKit::WebClipboard* BrowserWebKitPlatformSupportImpl::clipboard() { | 31 WebKit::WebClipboard* BrowserWebKitPlatformSupportImpl::clipboard() { |
24 NOTREACHED(); | 32 NOTREACHED(); |
25 return NULL; | 33 return NULL; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 NOTREACHED(); | 125 NOTREACHED(); |
118 return NULL; | 126 return NULL; |
119 } | 127 } |
120 | 128 |
121 int BrowserWebKitPlatformSupportImpl::databaseDeleteFile( | 129 int BrowserWebKitPlatformSupportImpl::databaseDeleteFile( |
122 const WebKit::WebString& vfs_file_name, bool sync_dir) { | 130 const WebKit::WebString& vfs_file_name, bool sync_dir) { |
123 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); | 131 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); |
124 return file_util::Delete(path, false) ? 0 : 1; | 132 return file_util::Delete(path, false) ? 0 : 1; |
125 } | 133 } |
126 | 134 |
| 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 |
127 GpuChannelHostFactory* | 164 GpuChannelHostFactory* |
128 BrowserWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 165 BrowserWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
129 return content::BrowserGpuChannelHostFactory::instance(); | 166 return content::BrowserGpuChannelHostFactory::instance(); |
130 } | 167 } |
OLD | NEW |