OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/renderer_webidbfactory_impl.h" | 5 #include "content/renderer/renderer_webidbfactory_impl.h" |
6 | 6 |
| 7 #include "content/common/indexed_db_messages.h" |
7 #include "content/renderer/render_thread.h" | 8 #include "content/renderer/render_thread.h" |
| 9 #include "content/renderer/render_view.h" |
8 #include "content/renderer/indexed_db_dispatcher.h" | 10 #include "content/renderer/indexed_db_dispatcher.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
11 | 14 |
12 using WebKit::WebDOMStringList; | 15 using WebKit::WebDOMStringList; |
13 using WebKit::WebFrame; | 16 using WebKit::WebFrame; |
14 using WebKit::WebIDBCallbacks; | 17 using WebKit::WebIDBCallbacks; |
15 using WebKit::WebIDBDatabase; | 18 using WebKit::WebIDBDatabase; |
16 using WebKit::WebSecurityOrigin; | 19 using WebKit::WebSecurityOrigin; |
17 using WebKit::WebString; | 20 using WebKit::WebString; |
18 | 21 |
19 RendererWebIDBFactoryImpl::RendererWebIDBFactoryImpl() { | 22 RendererWebIDBFactoryImpl::RendererWebIDBFactoryImpl() { |
20 } | 23 } |
21 | 24 |
22 RendererWebIDBFactoryImpl::~RendererWebIDBFactoryImpl() { | 25 RendererWebIDBFactoryImpl::~RendererWebIDBFactoryImpl() { |
23 } | 26 } |
24 | 27 |
| 28 WebKit::WebDOMStringList RendererWebIDBFactoryImpl::databaseNames( |
| 29 const WebSecurityOrigin& origin, |
| 30 WebFrame* web_frame, |
| 31 const WebString& data_dir, |
| 32 unsigned long long maximum_size_unused, |
| 33 WebKit::WebIDBFactory::BackingStoreType) { |
| 34 |
| 35 WebDOMStringList web_result; |
| 36 |
| 37 if (!web_frame) |
| 38 return web_result; // We must be shutting down. |
| 39 RenderView* render_view = RenderView::FromWebView(web_frame->view()); |
| 40 if (!render_view) |
| 41 return web_result; // We must be shutting down. |
| 42 |
| 43 IndexedDBHostMsg_FactoryDatabaseNames_Params params; |
| 44 params.routing_id = render_view->routing_id(); |
| 45 params.origin = origin.databaseIdentifier(); |
| 46 |
| 47 std::vector<string16> result; |
| 48 RenderThread::current()->Send( |
| 49 new IndexedDBHostMsg_FactoryDatabaseNames( |
| 50 params, |
| 51 &result)); |
| 52 for (std::vector<string16>::const_iterator it = result.begin(); |
| 53 it != result.end(); ++it) { |
| 54 web_result.append(*it); |
| 55 } |
| 56 return web_result; |
| 57 } |
| 58 |
25 void RendererWebIDBFactoryImpl::open( | 59 void RendererWebIDBFactoryImpl::open( |
26 const WebString& name, | 60 const WebString& name, |
27 WebIDBCallbacks* callbacks, | 61 WebIDBCallbacks* callbacks, |
28 const WebSecurityOrigin& origin, | 62 const WebSecurityOrigin& origin, |
29 WebFrame* web_frame, | 63 WebFrame* web_frame, |
30 const WebString& data_dir, | 64 const WebString& data_dir, |
31 unsigned long long maximum_size_unused, | 65 unsigned long long maximum_size_unused, |
32 WebKit::WebIDBFactory::BackingStoreType) { | 66 WebKit::WebIDBFactory::BackingStoreType) { |
33 // Don't send the data_dir. We know what we want on the Browser side of | 67 // Don't send the data_dir. We know what we want on the Browser side of |
34 // things. | 68 // things. |
(...skipping 20 matching lines...) Expand all Loading... |
55 WebFrame* web_frame, | 89 WebFrame* web_frame, |
56 const WebString& data_dir, | 90 const WebString& data_dir, |
57 WebKit::WebIDBFactory::BackingStoreType) { | 91 WebKit::WebIDBFactory::BackingStoreType) { |
58 // Don't send the data_dir. We know what we want on the Browser side of | 92 // Don't send the data_dir. We know what we want on the Browser side of |
59 // things. | 93 // things. |
60 IndexedDBDispatcher* dispatcher = | 94 IndexedDBDispatcher* dispatcher = |
61 RenderThread::current()->indexed_db_dispatcher(); | 95 RenderThread::current()->indexed_db_dispatcher(); |
62 dispatcher->RequestIDBFactoryDeleteDatabase( | 96 dispatcher->RequestIDBFactoryDeleteDatabase( |
63 name, callbacks, origin.databaseIdentifier(), web_frame); | 97 name, callbacks, origin.databaseIdentifier(), web_frame); |
64 } | 98 } |
OLD | NEW |