diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 01:15:54 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 01:15:54 +0000 |
commit | 1f8b34120905d0cb89f8a35c2a9e38ee1747c878 (patch) | |
tree | 63687e8e964bacf3491ad111d4aad28fc17dad25 /chrome/browser/in_process_webkit | |
parent | 97880fa256d45accb61d1c9887bb7e28724286cd (diff) | |
download | chromium_src-1f8b34120905d0cb89f8a35c2a9e38ee1747c878.zip chromium_src-1f8b34120905d0cb89f8a35c2a9e38ee1747c878.tar.gz chromium_src-1f8b34120905d0cb89f8a35c2a9e38ee1747c878.tar.bz2 |
This CL is doing a bunch of Misc work to make LocalStorage data persist.
First of all, this allows WebKit clients to specify whether or not the VFS should be used. In the browser process, we never want it to be.
Next, this allows WebKit clients to specify the behavior of WebKit's FileSystem code. By default, they should all be NOT_REACHED(). The browser process implements the two of these I need for LocalStorage, but it'll be really easy for the rest to be implemented as needed.
Next, this adds a function that storage routines can call to ensure that lazily initialized stuff that must be initialized on the main WebKit thread is initialized. Right now, this is just used to initialize the UTF8 conversion tables, but I'm sure there'll be more overt time.
Lastly, this uses the profile directory stored by webkit_context_ to derive the path LocalStorage should use.
This CL also cleans up a few minor style issues as it goes.
TEST=none
BUG=4360
Review URL: http://codereview.chromium.org/159778
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit')
4 files changed, 16 insertions, 13 deletions
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc index e1052db..33fc0de 100644 --- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc +++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc @@ -24,6 +24,10 @@ WebKit::WebSandboxSupport* BrowserWebKitClientImpl::sandboxSupport() { return NULL; } +bool BrowserWebKitClientImpl::sandboxEnabled() { + return false; +} + unsigned long long BrowserWebKitClientImpl::visitedLinkHash( const char* canonical_url, size_t length) { @@ -58,12 +62,6 @@ void BrowserWebKitClientImpl::prefetchHostName(const WebKit::WebString&) { NOTREACHED(); } -bool BrowserWebKitClientImpl::getFileSize(const WebKit::WebString& path, - long long& result) { - NOTREACHED(); - return false; -} - WebKit::WebString BrowserWebKitClientImpl::defaultLocale() { NOTREACHED(); return WebKit::WebString(); diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h index 61dffa6..546100d 100644 --- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h +++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h @@ -13,6 +13,7 @@ class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl { virtual WebKit::WebClipboard* clipboard(); virtual WebKit::WebMimeRegistry* mimeRegistry(); virtual WebKit::WebSandboxSupport* sandboxSupport(); + virtual bool sandboxEnabled(); virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length); virtual bool isLinkVisited(unsigned long long linkHash); @@ -23,7 +24,6 @@ class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl { virtual WebKit::WebString cookies(const WebKit::WebURL& url, const WebKit::WebURL& policy_url); virtual void prefetchHostName(const WebKit::WebString&); - virtual bool getFileSize(const WebKit::WebString& path, long long& result); virtual WebKit::WebString defaultLocale(); virtual WebKit::WebThemeEngine* themeEngine(); virtual WebKit::WebURLLoader* createURLLoader(); diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc index 8ef7ca4..0bc4df0 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -14,9 +14,11 @@ #include "webkit/api/public/WebStorageArea.h" #include "webkit/api/public/WebStorageNamespace.h" #include "webkit/api/public/WebString.h" +#include "webkit/glue/webkit_glue.h" using WebKit::WebStorageArea; using WebKit::WebStorageNamespace; +using WebKit::WebString; DOMStorageDispatcherHost::DOMStorageDispatcherHost( IPC::Message::Sender* message_sender, @@ -281,7 +283,7 @@ void DOMStorageDispatcherHost::OnGetItem(int64 storage_area_id, DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebStorageArea* storage_area = GetStorageArea(storage_area_id); CHECK(storage_area); // TODO(jorlow): Do better than this. - WebKit::WebString value = storage_area->getItem(key); + WebString value = storage_area->getItem(key); ViewHostMsg_DOMStorageGetItem::WriteReplyParams(reply_msg, (string16)value, value.isNull()); Send(reply_msg); @@ -375,8 +377,10 @@ int64 DOMStorageDispatcherHost::AddStorageNamespace( return new_namespace_id; } -string16 DOMStorageDispatcherHost::GetLocalStoragePath() { - // TODO(jorlow): Create a path based on the WebKitContext. - string16 path; - return path; +WebString DOMStorageDispatcherHost::GetLocalStoragePath() { + const FilePath& path = webkit_context_->data_path(); + if (path.empty()) + return WebString(); + FilePath::StringType path_string = path.AppendASCII("localStorage").value(); + return webkit_glue::FilePathStringToWebString(path_string); } diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h index 8e7e12f..38fee15 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h @@ -16,6 +16,7 @@ class WebKitThread; namespace WebKit { class WebStorageArea; class WebStorageNamespace; +class WebString; } // This class handles the logistics of DOM Storage within the browser process. @@ -69,7 +70,7 @@ class DOMStorageDispatcherHost : // Get the path to the LocalStorage directory. Calculate it if we haven't // already. Only call on the WebKit thread. - string16 GetLocalStoragePath(); + WebKit::WebString GetLocalStoragePath(); // Data shared between renderer processes with the same profile. scoped_refptr<WebKitContext> webkit_context_; |