diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:25:49 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:25:49 +0000 |
commit | da0c8e9e4c51699ef08ee449fe83fc1fb24b773d (patch) | |
tree | 671475593d2a739ed91dae72e631173ddd6219eb /chrome/browser/in_process_webkit | |
parent | 42da24d2930b8c2257f3560366a8eff766d8fb9b (diff) | |
download | chromium_src-da0c8e9e4c51699ef08ee449fe83fc1fb24b773d.zip chromium_src-da0c8e9e4c51699ef08ee449fe83fc1fb24b773d.tar.gz chromium_src-da0c8e9e4c51699ef08ee449fe83fc1fb24b773d.tar.bz2 |
Whitelist all content for various internal schemes.
BUG=34805
TEST=New Tab page should still work if you disable script + images
Review URL: http://codereview.chromium.org/588011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38536 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit')
4 files changed, 23 insertions, 23 deletions
diff --git a/chrome/browser/in_process_webkit/dom_storage_area.cc b/chrome/browser/in_process_webkit/dom_storage_area.cc index e2a4549..fc9bf80 100644 --- a/chrome/browser/in_process_webkit/dom_storage_area.cc +++ b/chrome/browser/in_process_webkit/dom_storage_area.cc @@ -13,7 +13,6 @@ #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" @@ -31,10 +30,10 @@ DOMStorageArea::DOMStorageArea( DOMStorageNamespace* owner, HostContentSettingsMap* host_content_settings_map) : origin_(origin), + origin_url_(origin), id_(id), owner_(owner), - host_content_settings_map_(host_content_settings_map), - host_(GURL(origin).host()) { + host_content_settings_map_(host_content_settings_map) { DCHECK(owner_); DCHECK(host_content_settings_map_); } @@ -111,7 +110,7 @@ void DOMStorageArea::CreateWebStorageAreaIfNecessary() { bool DOMStorageArea::CheckContentSetting() { ContentSetting content_setting = host_content_settings_map_->GetContentSetting( - host_, CONTENT_SETTINGS_TYPE_COOKIES); + origin_url_, CONTENT_SETTINGS_TYPE_COOKIES); if (content_setting == CONTENT_SETTING_ASK) { WebSecurityOrigin security_origin( @@ -131,7 +130,7 @@ bool DOMStorageArea::CheckContentSetting() { size = file_info.size; last_modified = file_info.last_modified; } - DOMStoragePermissionRequest request(host_, file_exists, size, + DOMStoragePermissionRequest request(origin_url_, file_exists, size, last_modified, host_content_settings_map_); ChromeThread::PostTask( diff --git a/chrome/browser/in_process_webkit/dom_storage_area.h b/chrome/browser/in_process_webkit/dom_storage_area.h index 36191db..4afc731 100644 --- a/chrome/browser/in_process_webkit/dom_storage_area.h +++ b/chrome/browser/in_process_webkit/dom_storage_area.h @@ -1,6 +1,6 @@ -// 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. +// 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_ @@ -11,6 +11,7 @@ #include "base/nullable_string16.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "googleurl/src/gurl.h" class DOMStorageNamespace; class HostContentSettingsMap; @@ -47,6 +48,7 @@ class DOMStorageArea { // The origin this storage area represents. string16 origin_; + GURL origin_url_; // The storage area we wrap. scoped_ptr<WebKit::WebStorageArea> storage_area_; @@ -59,9 +61,6 @@ class DOMStorageArea { 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_permission_request.cc b/chrome/browser/in_process_webkit/dom_storage_permission_request.cc index 3fd0045..4fb3293 100644 --- a/chrome/browser/in_process_webkit/dom_storage_permission_request.cc +++ b/chrome/browser/in_process_webkit/dom_storage_permission_request.cc @@ -8,12 +8,12 @@ #include "chrome/browser/message_box_handler.h" DOMStoragePermissionRequest::DOMStoragePermissionRequest( - const std::string& host, + const GURL& url, bool file_exists, int64 size, base::Time last_modified, HostContentSettingsMap* settings) - : host_(host), + : url_(url), file_exists_(file_exists), size_(size), last_modified_(last_modified), @@ -31,20 +31,20 @@ void DOMStoragePermissionRequest::SendResponse(ContentSetting content_setting, response_content_setting_ = content_setting; if (remember) { host_content_settings_map_->SetContentSetting( - host_, CONTENT_SETTINGS_TYPE_COOKIES, content_setting); + url_.host(), CONTENT_SETTINGS_TYPE_COOKIES, content_setting); } event_.Signal(); } // static void DOMStoragePermissionRequest::PromptUser( - DOMStoragePermissionRequest *dom_storage_permission_request) { + DOMStoragePermissionRequest* dom_storage_permission_request) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); // Cookie settings may have changed. ContentSetting setting = dom_storage_permission_request->host_content_settings_map_-> - GetContentSetting(dom_storage_permission_request->host(), + GetContentSetting(dom_storage_permission_request->url(), CONTENT_SETTINGS_TYPE_COOKIES); if (setting != CONTENT_SETTING_ASK) { dom_storage_permission_request->SendResponse(setting, false); @@ -60,13 +60,14 @@ void DOMStoragePermissionRequest::PromptUser( #if defined(OS_WIN) // TODO(darin): It seems like it would be interesting if the dialog actually // showed the name and value being stored (as is done for cookies). + const std::string& host = dom_storage_permission_request->url().host(); RunLocalStoragePrompt(browser->GetSelectedTabContents(), BrowsingDataLocalStorageHelper::LocalStorageInfo( std::string(), - dom_storage_permission_request->host(), + host, -1, std::string(), - dom_storage_permission_request->host(), + host, FilePath(), dom_storage_permission_request->size(), dom_storage_permission_request->last_modified()), diff --git a/chrome/browser/in_process_webkit/dom_storage_permission_request.h b/chrome/browser/in_process_webkit/dom_storage_permission_request.h index d84ed09..3b94177 100644 --- a/chrome/browser/in_process_webkit/dom_storage_permission_request.h +++ b/chrome/browser/in_process_webkit/dom_storage_permission_request.h @@ -13,12 +13,13 @@ #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" #include "chrome/common/content_settings.h" +#include "googleurl/src/gurl.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 CookiePromptModalDialogDelegate { public: - DOMStoragePermissionRequest(const std::string& host, + DOMStoragePermissionRequest(const GURL& url, bool file_exists, int64 size, base::Time last_modified, @@ -28,21 +29,21 @@ class DOMStoragePermissionRequest : public CookiePromptModalDialogDelegate { ContentSetting WaitOnResponse(); void SendResponse(ContentSetting content_setting, bool remember); - const std::string& host() const { return host_; } + const GURL& url() const { return url_; } bool file_exists() const { return file_exists_; } int64 size() const { return size_; } const base::Time last_modified() const { return last_modified_; } // Called on the UI thread. - static void PromptUser(DOMStoragePermissionRequest *request); + static void PromptUser(DOMStoragePermissionRequest* request); // CookiesPromptViewDelegate methods: virtual void AllowSiteData(bool remember, bool session_expire); virtual void BlockSiteData(bool remember); private: - // The host we need to get permission for. - const std::string host_; + // The URL we need to get permission for. + const GURL url_; // Is there any information on disk currently? bool file_exists_; |