OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/renderer_webkitclient_impl.h" | 5 #include "chrome/renderer/renderer_webkitclient_impl.h" |
6 | 6 |
7 #if defined(USE_SYSTEM_SQLITE) | 7 #if defined(USE_SYSTEM_SQLITE) |
8 #include <sqlite3.h> | 8 #include <sqlite3.h> |
9 #else | 9 #else |
10 #include "third_party/sqlite/preprocessed/sqlite3.h" | 10 #include "third_party/sqlite/preprocessed/sqlite3.h" |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "chrome/common/appcache/appcache_dispatcher.h" | 16 #include "chrome/common/appcache/appcache_dispatcher.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/db_message_filter.h" | 18 #include "chrome/common/db_message_filter.h" |
19 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
20 #include "chrome/common/webmessageportchannel_impl.h" | 20 #include "chrome/common/webmessageportchannel_impl.h" |
21 #include "chrome/plugin/npobject_util.h" | 21 #include "chrome/plugin/npobject_util.h" |
22 #include "chrome/renderer/net/render_dns_master.h" | 22 #include "chrome/renderer/net/render_dns_master.h" |
23 #include "chrome/renderer/render_thread.h" | 23 #include "chrome/renderer/render_thread.h" |
24 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" | 24 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" |
25 #include "chrome/renderer/visitedlink_slave.h" | 25 #include "chrome/renderer/visitedlink_slave.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 #include "webkit/api/public/WebCookie.h" | 27 #include "webkit/api/public/WebCookie.h" |
| 28 #include "webkit/api/public/WebStorageEventDispatcher.h" |
28 #include "webkit/api/public/WebString.h" | 29 #include "webkit/api/public/WebString.h" |
29 #include "webkit/api/public/WebURL.h" | 30 #include "webkit/api/public/WebURL.h" |
30 #include "webkit/api/public/WebVector.h" | 31 #include "webkit/api/public/WebVector.h" |
31 #include "webkit/appcache/web_application_cache_host_impl.h" | 32 #include "webkit/appcache/web_application_cache_host_impl.h" |
32 #include "webkit/glue/glue_util.h" | 33 #include "webkit/glue/glue_util.h" |
33 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
34 | 35 |
35 #if defined(OS_LINUX) | 36 #if defined(OS_LINUX) |
36 #include "chrome/renderer/renderer_sandbox_support_linux.h" | 37 #include "chrome/renderer/renderer_sandbox_support_linux.h" |
37 #endif | 38 #endif |
38 | 39 |
39 #if defined(OS_POSIX) | 40 #if defined(OS_POSIX) |
40 #include "base/file_descriptor_posix.h" | 41 #include "base/file_descriptor_posix.h" |
41 #endif | 42 #endif |
42 | 43 |
43 using WebKit::WebApplicationCacheHost; | 44 using WebKit::WebApplicationCacheHost; |
44 using WebKit::WebApplicationCacheHostClient; | 45 using WebKit::WebApplicationCacheHostClient; |
45 using WebKit::WebCookie; | 46 using WebKit::WebCookie; |
46 using WebKit::WebKitClient; | 47 using WebKit::WebKitClient; |
47 using WebKit::WebStorageArea; | 48 using WebKit::WebStorageArea; |
| 49 using WebKit::WebStorageEventDispatcher; |
48 using WebKit::WebStorageNamespace; | 50 using WebKit::WebStorageNamespace; |
49 using WebKit::WebString; | 51 using WebKit::WebString; |
50 using WebKit::WebURL; | 52 using WebKit::WebURL; |
51 using WebKit::WebVector; | 53 using WebKit::WebVector; |
52 | 54 |
53 //------------------------------------------------------------------------------ | 55 //------------------------------------------------------------------------------ |
54 | 56 |
55 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() { | 57 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() { |
56 return &clipboard_; | 58 return &clipboard_; |
57 } | 59 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return WebStorageNamespace::createLocalStorageNamespace(path, quota); | 196 return WebStorageNamespace::createLocalStorageNamespace(path, quota); |
195 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); | 197 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); |
196 } | 198 } |
197 | 199 |
198 WebStorageNamespace* RendererWebKitClientImpl::createSessionStorageNamespace() { | 200 WebStorageNamespace* RendererWebKitClientImpl::createSessionStorageNamespace() { |
199 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 201 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
200 return WebStorageNamespace::createSessionStorageNamespace(); | 202 return WebStorageNamespace::createSessionStorageNamespace(); |
201 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION); | 203 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION); |
202 } | 204 } |
203 | 205 |
| 206 void RendererWebKitClientImpl::dispatchStorageEvent( |
| 207 const WebString& key, const WebString& old_value, |
| 208 const WebString& new_value, const WebString& origin, |
| 209 bool is_local_storage) { |
| 210 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); |
| 211 // Inefficient, but only used in single process mode. |
| 212 scoped_ptr<WebStorageEventDispatcher> event_dispatcher( |
| 213 WebStorageEventDispatcher::create()); |
| 214 event_dispatcher->dispatchStorageEvent(key, old_value, new_value, origin, |
| 215 is_local_storage); |
| 216 } |
| 217 |
204 WebApplicationCacheHost* RendererWebKitClientImpl::createApplicationCacheHost( | 218 WebApplicationCacheHost* RendererWebKitClientImpl::createApplicationCacheHost( |
205 WebApplicationCacheHostClient* client) { | 219 WebApplicationCacheHostClient* client) { |
206 return new appcache::WebApplicationCacheHostImpl(client, | 220 return new appcache::WebApplicationCacheHostImpl(client, |
207 RenderThread::current()->appcache_dispatcher()->backend_proxy()); | 221 RenderThread::current()->appcache_dispatcher()->backend_proxy()); |
208 } | 222 } |
209 | 223 |
210 //------------------------------------------------------------------------------ | 224 //------------------------------------------------------------------------------ |
211 | 225 |
212 WebString RendererWebKitClientImpl::MimeRegistry::mimeTypeForExtension( | 226 WebString RendererWebKitClientImpl::MimeRegistry::mimeTypeForExtension( |
213 const WebString& file_extension) { | 227 const WebString& file_extension) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 const WebKit::WebString& challenge, | 378 const WebKit::WebString& challenge, |
365 const WebKit::WebURL& url) { | 379 const WebKit::WebURL& url) { |
366 std::string signed_public_key; | 380 std::string signed_public_key; |
367 RenderThread::current()->Send(new ViewHostMsg_Keygen( | 381 RenderThread::current()->Send(new ViewHostMsg_Keygen( |
368 static_cast<uint32>(key_size_index), | 382 static_cast<uint32>(key_size_index), |
369 webkit_glue::WebStringToStdString(challenge), | 383 webkit_glue::WebStringToStdString(challenge), |
370 GURL(url), | 384 GURL(url), |
371 &signed_public_key)); | 385 &signed_public_key)); |
372 return webkit_glue::StdStringToWebString(signed_public_key); | 386 return webkit_glue::StdStringToWebString(signed_public_key); |
373 } | 387 } |
OLD | NEW |