diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 19:01:42 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 19:01:42 +0000 |
commit | 9622ca5f54236d00bc8cf6ce9c545b366d8f92a2 (patch) | |
tree | 6facb51dfcd785dbd4dac757b7b2a68cbb0ac752 | |
parent | 41b06b2da057ccd20255295026dc5509a1b4a7d9 (diff) | |
download | chromium_src-9622ca5f54236d00bc8cf6ce9c545b366d8f92a2.zip chromium_src-9622ca5f54236d00bc8cf6ce9c545b366d8f92a2.tar.gz chromium_src-9622ca5f54236d00bc8cf6ce9c545b366d8f92a2.tar.bz2 |
Add support for fine grained permissions to use LocalStorage.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/565004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37856 0039d316-1c4b-4281-b951-d872f2087c98
13 files changed, 248 insertions, 42 deletions
diff --git a/base/nullable_string16.h b/base/nullable_string16.h index 6f69aa5..6f07183 100644 --- a/base/nullable_string16.h +++ b/base/nullable_string16.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ class NullableString16 { public: NullableString16() : is_null_(false) { } + explicit NullableString16(bool is_null) : is_null_(is_null) { } NullableString16(const string16& string, bool is_null) : string_(string), is_null_(is_null) { } diff --git a/chrome/browser/in_process_webkit/dom_storage_area.cc b/chrome/browser/in_process_webkit/dom_storage_area.cc index 32295a5..bda59cf 100644 --- a/chrome/browser/in_process_webkit/dom_storage_area.cc +++ b/chrome/browser/in_process_webkit/dom_storage_area.cc @@ -1,48 +1,78 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. #include "chrome/browser/in_process_webkit/dom_storage_area.h" +#include "base/file_path.h" +#include "base/file_util.h" +#include "base/task.h" +#include "chrome/browser/chrome_thread.h" +#include "chrome/browser/in_process_webkit/dom_storage_context.h" #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" #include "chrome/browser/in_process_webkit/dom_storage_namespace.h" +#include "chrome/browser/in_process_webkit/dom_storage_permission_request.h" +#include "chrome/browser/host_content_settings_map.h" +#include "googleurl/src/gurl.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/glue/webkit_glue.h" +using WebKit::WebSecurityOrigin; using WebKit::WebStorageArea; using WebKit::WebString; using WebKit::WebURL; -DOMStorageArea::DOMStorageArea(const string16& origin, - int64 id, - DOMStorageNamespace* owner) +DOMStorageArea::DOMStorageArea( + const string16& origin, + int64 id, + DOMStorageNamespace* owner, + HostContentSettingsMap* host_content_settings_map) : origin_(origin), id_(id), - owner_(owner) { + owner_(owner), + host_content_settings_map_(host_content_settings_map), + host_(GURL(origin).host()) { DCHECK(owner_); + DCHECK(host_content_settings_map_); } DOMStorageArea::~DOMStorageArea() { } unsigned DOMStorageArea::Length() { + if (!CheckContentSetting()) + return 0; // Pretend we're an empty store. + CreateWebStorageAreaIfNecessary(); return storage_area_->length(); } NullableString16 DOMStorageArea::Key(unsigned index) { + if (!CheckContentSetting()) + return NullableString16(true); // Null string. + CreateWebStorageAreaIfNecessary(); return storage_area_->key(index); } NullableString16 DOMStorageArea::GetItem(const string16& key) { + if (!CheckContentSetting()) + return NullableString16(true); // Null string. + CreateWebStorageAreaIfNecessary(); return storage_area_->getItem(key); } NullableString16 DOMStorageArea::SetItem( const string16& key, const string16& value, bool* quota_exception) { + if (!CheckContentSetting()) { + *quota_exception = true; + return NullableString16(true); // Ignored if exception is true. + } + CreateWebStorageAreaIfNecessary(); WebString old_value; storage_area_->setItem(key, value, WebURL(), *quota_exception, old_value); @@ -50,6 +80,9 @@ NullableString16 DOMStorageArea::SetItem( } NullableString16 DOMStorageArea::RemoveItem(const string16& key) { + if (!CheckContentSetting()) + return NullableString16(true); // Indicates nothing removed. + CreateWebStorageAreaIfNecessary(); WebString old_value; storage_area_->removeItem(key, WebURL(), old_value); @@ -57,6 +90,9 @@ NullableString16 DOMStorageArea::RemoveItem(const string16& key) { } bool DOMStorageArea::Clear() { + if (!CheckContentSetting()) + return false; // Nothing cleared. + CreateWebStorageAreaIfNecessary(); bool somethingCleared; storage_area_->clear(WebURL(), somethingCleared); @@ -71,3 +107,42 @@ void DOMStorageArea::CreateWebStorageAreaIfNecessary() { if (!storage_area_.get()) storage_area_.reset(owner_->CreateWebStorageArea(origin_)); } + +bool DOMStorageArea::CheckContentSetting() { + ContentSetting content_setting = + host_content_settings_map_->GetContentSetting( + host_, CONTENT_SETTINGS_TYPE_COOKIES); + + if (content_setting == CONTENT_SETTING_ASK) { + WebSecurityOrigin security_origin( + WebSecurityOrigin::createFromString(origin_)); + FilePath::StringType file_name = webkit_glue::WebStringToFilePath( + security_origin.databaseIdentifier()).value(); + file_name.append(DOMStorageContext::kLocalStorageExtension); + FilePath file_path = webkit_glue::WebStringToFilePath( + owner_->data_dir_path()).Append(file_name); + + bool file_exists = false; + int64 size = 0; + base::Time last_modified; + file_util::FileInfo file_info; + if (file_util::GetFileInfo(file_path, &file_info)) { + file_exists = true; + size = file_info.size; + last_modified = file_info.last_modified; + } + DOMStoragePermissionRequest request(host_, file_exists, size, + last_modified); + // TODO(jorlow/darin): Do something useful instead of calling DoSomething. + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableFunction(&DOMStoragePermissionRequest::DoSomething, + &request)); + content_setting = request.WaitOnResponse(); + } + + if (content_setting == CONTENT_SETTING_ALLOW) + return true; + DCHECK(content_setting == CONTENT_SETTING_BLOCK); + return false; +} diff --git a/chrome/browser/in_process_webkit/dom_storage_area.h b/chrome/browser/in_process_webkit/dom_storage_area.h index f53df58..36191db 100644 --- a/chrome/browser/in_process_webkit/dom_storage_area.h +++ b/chrome/browser/in_process_webkit/dom_storage_area.h @@ -1,15 +1,19 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ +#include <string> + #include "base/hash_tables.h" #include "base/nullable_string16.h" +#include "base/ref_counted.h" #include "base/scoped_ptr.h" class DOMStorageNamespace; +class HostContentSettingsMap; namespace WebKit { class WebStorageArea; @@ -19,7 +23,10 @@ class WebStorageArea; // with DOMStorageContext. class DOMStorageArea { public: - DOMStorageArea(const string16& origin, int64 id, DOMStorageNamespace* owner); + DOMStorageArea(const string16& origin, + int64 id, + DOMStorageNamespace* owner, + HostContentSettingsMap* host_content_settings_map); ~DOMStorageArea(); unsigned Length(); @@ -30,6 +37,7 @@ class DOMStorageArea { NullableString16 RemoveItem(const string16& key); bool Clear(); void PurgeMemory(); + bool CheckContentSetting(); int64 id() const { return id_; } @@ -49,6 +57,11 @@ class DOMStorageArea { // The DOMStorageNamespace that owns us. DOMStorageNamespace* owner_; + scoped_refptr<HostContentSettingsMap> host_content_settings_map_; + + // The host portion of the origin_. + const std::string host_; + DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageArea); }; 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 aab6a5b..dc5835a 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -10,7 +10,9 @@ #include "chrome/browser/in_process_webkit/dom_storage_context.h" #include "chrome/browser/in_process_webkit/dom_storage_namespace.h" #include "chrome/browser/in_process_webkit/webkit_thread.h" +#include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" +#include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/render_messages.h" #include "googleurl/src/gurl.h" @@ -39,23 +41,25 @@ ScopedStorageEventContext::~ScopedStorageEventContext() { } DOMStorageDispatcherHost::DOMStorageDispatcherHost( - IPC::Message::Sender* message_sender, WebKitContext* webkit_context, + ResourceMessageFilter* resource_message_filter, + WebKitContext* webkit_context, WebKitThread* webkit_thread) : webkit_context_(webkit_context), webkit_thread_(webkit_thread), - message_sender_(message_sender), + resource_message_filter_(resource_message_filter), process_handle_(0) { DCHECK(webkit_context_.get()); DCHECK(webkit_thread_); - DCHECK(message_sender_); + DCHECK(resource_message_filter_); } DOMStorageDispatcherHost::~DOMStorageDispatcherHost() { } -void DOMStorageDispatcherHost::Init(base::ProcessHandle process_handle) { +void DOMStorageDispatcherHost::Init( + base::ProcessHandle process_handle) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - DCHECK(message_sender_); // Make sure Shutdown() has not yet been called. + DCHECK(resource_message_filter_); // Ensure Shutdown() has not been called. DCHECK(!process_handle_); // Make sure Init() has not yet been called. DCHECK(process_handle); Context()->RegisterDispatcherHost(this); @@ -66,7 +70,7 @@ void DOMStorageDispatcherHost::Shutdown() { if (ChromeThread::CurrentlyOn(ChromeThread::IO)) { if (process_handle_) // Init() was called Context()->UnregisterDispatcherHost(this); - message_sender_ = NULL; + resource_message_filter_ = NULL; // The task will only execute if the WebKit thread is already running. ChromeThread::PostTask( @@ -76,7 +80,7 @@ void DOMStorageDispatcherHost::Shutdown() { } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - DCHECK(!message_sender_); + DCHECK(!resource_message_filter_); // TODO(jorlow): Do stuff that needs to be run on the WebKit thread. Locks // and others will likely need this, so let's not delete this @@ -131,13 +135,13 @@ int64 DOMStorageDispatcherHost::CloneSessionStorage(int64 original_id) { } void DOMStorageDispatcherHost::Send(IPC::Message* message) { - if (!message_sender_) { + if (!resource_message_filter_) { delete message; return; } if (ChromeThread::CurrentlyOn(ChromeThread::IO)) { - message_sender_->Send(message); + resource_message_filter_->Send(message); return; } @@ -151,13 +155,17 @@ void DOMStorageDispatcherHost::Send(IPC::Message* message) { void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, const string16& origin, IPC::Message* reply_msg) { - if (ChromeThread::CurrentlyOn(ChromeThread::IO)) { - ChromeThread::PostTask(ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( - this, &DOMStorageDispatcherHost::OnStorageAreaId, namespace_id, origin, - reply_msg)); - return; - } + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); + ChromeURLRequestContext* url_request_context = + resource_message_filter_->GetRequestContextForURL(GURL(origin)); + ChromeThread::PostTask(ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( + this, &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, namespace_id, + origin, reply_msg, url_request_context->host_content_settings_map())); +} +void DOMStorageDispatcherHost::OnStorageAreaIdWebKit( + int64 namespace_id, const string16& origin, IPC::Message* reply_msg, + HostContentSettingsMap* host_content_settings_map) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); DOMStorageNamespace* storage_namespace = Context()->GetStorageNamespace(namespace_id, true); @@ -167,7 +175,8 @@ void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, delete reply_msg; return; } - DOMStorageArea* storage_area = storage_namespace->GetStorageArea(origin); + DOMStorageArea* storage_area = storage_namespace->GetStorageArea( + origin, host_content_settings_map); ViewHostMsg_DOMStorageStorageAreaId::WriteReplyParams(reply_msg, storage_area->id()); Send(reply_msg); 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 fe4b3b7..30176d7 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -15,6 +15,8 @@ class DOMStorageContext; class GURL; +class HostContentSettingsMap; +class ResourceMessageFilter; class Task; class WebKitThread; struct ViewMsg_DOMStorageEvent_Params; @@ -26,7 +28,8 @@ class DOMStorageDispatcherHost : public base::RefCountedThreadSafe<DOMStorageDispatcherHost> { public: // Only call the constructor from the UI thread. - DOMStorageDispatcherHost(IPC::Message::Sender* message_sender, + DOMStorageDispatcherHost( + ResourceMessageFilter* resource_message_filter_, WebKitContext* webkit_context, WebKitThread* webkit_thread); // Only call from ResourceMessageFilter on the IO thread. @@ -70,6 +73,11 @@ class DOMStorageDispatcherHost const GURL& url, IPC::Message* reply_msg); void OnClear(int64 storage_area_id, const GURL& url, IPC::Message* reply_msg); + // WebKit thread half of OnStorageAreaId + void OnStorageAreaIdWebKit( + int64 namespace_id, const string16& origin, IPC::Message* reply_msg, + HostContentSettingsMap* host_context_settings_map); + // Only call on the IO thread. void OnStorageEvent(const ViewMsg_DOMStorageEvent_Params& params); @@ -96,8 +104,8 @@ class DOMStorageDispatcherHost // ResourceDispatcherHost takes care of destruction. Immutable. WebKitThread* webkit_thread_; - // Only set on the IO thread. - IPC::Message::Sender* message_sender_; + // Only set and use on the IO thread. + ResourceMessageFilter* resource_message_filter_; // If we get a corrupt message from a renderer, we need to kill it using this // handle. diff --git a/chrome/browser/in_process_webkit/dom_storage_namespace.cc b/chrome/browser/in_process_webkit/dom_storage_namespace.cc index 2750a9f..602b24d 100644 --- a/chrome/browser/in_process_webkit/dom_storage_namespace.cc +++ b/chrome/browser/in_process_webkit/dom_storage_namespace.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -54,7 +54,9 @@ DOMStorageNamespace::~DOMStorageNamespace() { } } -DOMStorageArea* DOMStorageNamespace::GetStorageArea(const string16& origin) { +DOMStorageArea* DOMStorageNamespace::GetStorageArea( + const string16& origin, + HostContentSettingsMap* host_content_settings_map) { // We may have already created it for another dispatcher host. OriginToStorageAreaMap::iterator iter = origin_to_storage_area_.find(origin); if (iter != origin_to_storage_area_.end()) @@ -63,7 +65,8 @@ DOMStorageArea* DOMStorageNamespace::GetStorageArea(const string16& origin) { // We need to create a new one. int64 id = dom_storage_context_->AllocateStorageAreaId(); DCHECK(!dom_storage_context_->GetStorageArea(id)); - DOMStorageArea* storage_area = new DOMStorageArea(origin, id, this); + DOMStorageArea* storage_area = new DOMStorageArea(origin, id, this, + host_content_settings_map); origin_to_storage_area_[origin] = storage_area; dom_storage_context_->RegisterStorageArea(storage_area); return storage_area; diff --git a/chrome/browser/in_process_webkit/dom_storage_namespace.h b/chrome/browser/in_process_webkit/dom_storage_namespace.h index 189d696..4d365b2 100644 --- a/chrome/browser/in_process_webkit/dom_storage_namespace.h +++ b/chrome/browser/in_process_webkit/dom_storage_namespace.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -14,6 +14,7 @@ class DOMStorageArea; class DOMStorageContext; class FilePath; +class HostContentSettingsMap; namespace WebKit { class WebStorageArea; @@ -30,7 +31,8 @@ class DOMStorageNamespace { ~DOMStorageNamespace(); - DOMStorageArea* GetStorageArea(const string16& origin); + DOMStorageArea* GetStorageArea(const string16& origin, + HostContentSettingsMap* map); DOMStorageNamespace* Copy(int64 clone_namespace_id); void PurgeMemory(); @@ -39,6 +41,7 @@ class DOMStorageNamespace { return dom_storage_context_; } int64 id() const { return id_; } + const WebKit::WebString& data_dir_path() const { return data_dir_path_; } DOMStorageType dom_storage_type() const { return dom_storage_type_; } // Creates a WebStorageArea for the given origin. This should only be called diff --git a/chrome/browser/in_process_webkit/dom_storage_permission_request.cc b/chrome/browser/in_process_webkit/dom_storage_permission_request.cc new file mode 100644 index 0000000..05635aa --- /dev/null +++ b/chrome/browser/in_process_webkit/dom_storage_permission_request.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +#include "chrome/browser/in_process_webkit/dom_storage_permission_request.h" + +DOMStoragePermissionRequest::DOMStoragePermissionRequest( + const std::string& host, + bool file_exists, + int64 size, + const base::Time last_modified) + : host_(host), + file_exists_(file_exists), + size_(size), + last_modified_(last_modified), + event_(true, false) { // manual reset, not initially signaled +} + +ContentSetting DOMStoragePermissionRequest::WaitOnResponse() { + event_.Wait(); + return response_content_setting_; +} + +void DOMStoragePermissionRequest::SendResponse(ContentSetting content_setting) { + response_content_setting_ = content_setting; + event_.Signal(); +} + +// static +void DOMStoragePermissionRequest::DoSomething( + DOMStoragePermissionRequest *dom_storage_permission_request) { + // TODO(jorlow/darin): This function is just a placeholder until we work out + // exactly what needs to happen here. + dom_storage_permission_request->SendResponse(CONTENT_SETTING_BLOCK); +} diff --git a/chrome/browser/in_process_webkit/dom_storage_permission_request.h b/chrome/browser/in_process_webkit/dom_storage_permission_request.h new file mode 100644 index 0000000..362cf52 --- /dev/null +++ b/chrome/browser/in_process_webkit/dom_storage_permission_request.h @@ -0,0 +1,56 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ +#define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ + +#include <string> + +#include "base/time.h" +#include "base/waitable_event.h" +#include "chrome/common/content_settings.h" + +// This class is used to request content setting related permission for local +// storage. It should only be used for one such event and then discarded. +class DOMStoragePermissionRequest { + public: + DOMStoragePermissionRequest(const std::string& host, + bool file_exists_, + int64 size, + const base::Time last_modified); + + ContentSetting WaitOnResponse(); + void SendResponse(ContentSetting content_setting); + + const std::string& host() const { return host_; } + bool file_exists() const { return file_exists_; } + int64 size() const { return size_; } + const base::Time last_modified() const { return last_modified_; } + + // Just an example. + static void DoSomething(DOMStoragePermissionRequest *request); + + private: + // The host we need to get permission for. + const std::string host_; + + // Is there any information on disk currently? + bool file_exists_; + + // If file_exists_, what's the size? + int64 size_; + + // If file_exists_, what's the size? + const base::Time last_modified_; + + // The response to the permission request. + ContentSetting response_content_setting_; + + // One time use. Never reset. + base::WaitableEvent event_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStoragePermissionRequest); +}; + +#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index b6d7e46..8d4186d 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -102,7 +102,7 @@ class ChromeURLRequestContext : public URLRequestContext, virtual bool InterceptResponseCookie(const URLRequest* request, const std::string& cookie) const; - const HostContentSettingsMap* host_content_settings_map() const { + HostContentSettingsMap* host_content_settings_map() { return host_content_settings_map_; } diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index ff8131b..7979b3f 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -1035,9 +1035,9 @@ Clipboard* ResourceMessageFilter::GetClipboard() { return clipboard; } -ChromeURLRequestContext* -ResourceMessageFilter::GetRequestContextForURL( +ChromeURLRequestContext* ResourceMessageFilter::GetRequestContextForURL( const GURL& url) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); URLRequestContextGetter* context_getter = url.SchemeIs(chrome::kExtensionScheme) ? extensions_request_context_ : request_context_; diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 7cc55658..3931c83 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -113,6 +113,11 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, const NotificationSource& source, const NotificationDetails& details); + // Returns either the extension URLRequestContext or regular URLRequestContext + // depending on whether |url| is an extension URL. + // Only call on the IO thread. + ChromeURLRequestContext* GetRequestContextForURL(const GURL& url); + private: friend class ChromeThread; friend class DeleteTask<ResourceMessageFilter>; @@ -336,10 +341,6 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, // thread. static Clipboard* GetClipboard(); - // Returns either the extension URLRequestContext or regular URLRequestContext - // depending on whether |url| is an extension URL. - ChromeURLRequestContext* GetRequestContextForURL(const GURL& url); - NotificationRegistrar registrar_; // The channel associated with the renderer connection. This pointer is not diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 6b2f41a..f2038b5 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1189,6 +1189,8 @@ 'browser/in_process_webkit/dom_storage_dispatcher_host.h', 'browser/in_process_webkit/dom_storage_namespace.cc', 'browser/in_process_webkit/dom_storage_namespace.h', + 'browser/in_process_webkit/dom_storage_permission_request.cc', + 'browser/in_process_webkit/dom_storage_permission_request.h', 'browser/in_process_webkit/webkit_context.cc', 'browser/in_process_webkit/webkit_context.h', 'browser/in_process_webkit/webkit_thread.cc', |