| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" | 5 #include "chrome/browser/in_process_webkit/browser_webkitclient_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 "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 9 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
| 10 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" | 10 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" |
| 11 #include "chrome/common/indexed_db_key.h" | 11 #include "chrome/common/indexed_db_key.h" |
| 12 #include "chrome/common/serialized_script_value.h" | 12 #include "chrome/common/serialized_script_value.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
| 14 #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 17 #include "webkit/glue/webkit_glue.h" | 17 #include "webkit/glue/webkit_glue.h" |
| 18 | 18 |
| 19 BrowserWebKitClientImpl::BrowserWebKitClientImpl() { | 19 BrowserWebKitClientImpl::BrowserWebKitClientImpl() { |
| 20 file_utilities_.set_sandbox_enabled(false); | 20 file_utilities_.set_sandbox_enabled(false); |
| 21 } | 21 } |
| 22 | 22 |
| 23 BrowserWebKitClientImpl::~BrowserWebKitClientImpl() { |
| 24 } |
| 25 |
| 23 WebKit::WebClipboard* BrowserWebKitClientImpl::clipboard() { | 26 WebKit::WebClipboard* BrowserWebKitClientImpl::clipboard() { |
| 24 NOTREACHED(); | 27 NOTREACHED(); |
| 25 return NULL; | 28 return NULL; |
| 26 } | 29 } |
| 27 | 30 |
| 28 WebKit::WebMimeRegistry* BrowserWebKitClientImpl::mimeRegistry() { | 31 WebKit::WebMimeRegistry* BrowserWebKitClientImpl::mimeRegistry() { |
| 29 NOTREACHED(); | 32 NOTREACHED(); |
| 30 return NULL; | 33 return NULL; |
| 31 } | 34 } |
| 32 | 35 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 NOTREACHED(); | 140 NOTREACHED(); |
| 138 return NULL; | 141 return NULL; |
| 139 } | 142 } |
| 140 | 143 |
| 141 int BrowserWebKitClientImpl::databaseDeleteFile( | 144 int BrowserWebKitClientImpl::databaseDeleteFile( |
| 142 const WebKit::WebString& vfs_file_name, bool sync_dir) { | 145 const WebKit::WebString& vfs_file_name, bool sync_dir) { |
| 143 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); | 146 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); |
| 144 return file_util::Delete(path, false) ? 0 : 1; | 147 return file_util::Delete(path, false) ? 0 : 1; |
| 145 } | 148 } |
| 146 | 149 |
| 150 void BrowserWebKitClientImpl::idbShutdown() { |
| 151 if (indexed_db_key_utility_client_.get()) |
| 152 indexed_db_key_utility_client_->EndUtilityProcess(); |
| 153 } |
| 154 |
| 147 void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath( | 155 void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath( |
| 148 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, | 156 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, |
| 149 const WebKit::WebString& keyPath, | 157 const WebKit::WebString& keyPath, |
| 150 WebKit::WebVector<WebKit::WebIDBKey>& keys) { | 158 WebKit::WebVector<WebKit::WebIDBKey>& keys) { |
| 151 // TODO(bulach): we need to figure out a way to keep the utility process | 159 if (!indexed_db_key_utility_client_.get()) { |
| 152 // running for longer, and shut it down when no longer used. | 160 indexed_db_key_utility_client_ = new IndexedDBKeyUtilityClient(); |
| 153 scoped_refptr<IndexedDBKeyUtilityClient> indexed_db_key_utility_client( | 161 indexed_db_key_utility_client_->StartUtilityProcess(); |
| 154 new IndexedDBKeyUtilityClient()); | 162 } |
| 155 indexed_db_key_utility_client->StartUtilityProcess(); | |
| 156 | 163 |
| 157 std::vector<SerializedScriptValue> std_values; | 164 std::vector<SerializedScriptValue> std_values; |
| 158 size_t size = values.size(); | 165 size_t size = values.size(); |
| 159 std_values.reserve(size); | 166 std_values.reserve(size); |
| 160 for (size_t i = 0; i < size; ++i) | 167 for (size_t i = 0; i < size; ++i) |
| 161 std_values.push_back(SerializedScriptValue(values[i])); | 168 std_values.push_back(SerializedScriptValue(values[i])); |
| 162 | 169 |
| 163 std::vector<IndexedDBKey> std_keys; | 170 std::vector<IndexedDBKey> std_keys; |
| 164 indexed_db_key_utility_client->CreateIDBKeysFromSerializedValuesAndKeyPath( | 171 indexed_db_key_utility_client_->CreateIDBKeysFromSerializedValuesAndKeyPath( |
| 165 std_values, keyPath, &std_keys); | 172 std_values, keyPath, &std_keys); |
| 166 | 173 |
| 167 indexed_db_key_utility_client->EndUtilityProcess(); | |
| 168 | |
| 169 keys = std_keys; | 174 keys = std_keys; |
| 170 } | 175 } |
| OLD | NEW |