Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/chrome_render_message_filter.cc
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index b7c864d0c12d4d41e1344bf07493862cdd71c170..6defc5a591a8b97b16152e68ef987c77a740fa9d 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -92,6 +92,7 @@ ChromeRenderMessageFilter::ChromeRenderMessageFilter(
profile_->GetPrefs(), NULL);
always_authorize_plugins_.MoveToThread(BrowserThread::IO);
host_content_settings_map_ = profile->GetHostContentSettingsMap();
+ cookie_content_settings_ = profile->GetCookieContentSettings();
}
ChromeRenderMessageFilter::~ChromeRenderMessageFilter() {
@@ -426,13 +427,7 @@ void ChromeRenderMessageFilter::OnAllowDatabase(int render_view_id,
const string16& name,
const string16& display_name,
bool* allowed) {
- ContentSetting setting = host_content_settings_map_->GetCookieContentSetting(
- origin_url, top_origin_url, true);
- DCHECK((setting == CONTENT_SETTING_ALLOW) ||
- (setting == CONTENT_SETTING_BLOCK) ||
- (setting == CONTENT_SETTING_SESSION_ONLY));
- *allowed = setting != CONTENT_SETTING_BLOCK;
-
+ *allowed = cookie_content_settings_->Allow(origin_url, top_origin_url, true);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableFunction(
@@ -446,9 +441,7 @@ void ChromeRenderMessageFilter::OnAllowDOMStorage(int render_view_id,
const GURL& top_origin_url,
DOMStorageType type,
bool* allowed) {
- ContentSetting setting = host_content_settings_map_->GetCookieContentSetting(
- origin_url, top_origin_url, true);
- *allowed = setting != CONTENT_SETTING_BLOCK;
+ *allowed = cookie_content_settings_->Allow(origin_url, top_origin_url, true);
// Record access to DOM storage for potential display in UI.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -461,12 +454,7 @@ void ChromeRenderMessageFilter::OnAllowFileSystem(int render_view_id,
const GURL& origin_url,
const GURL& top_origin_url,
bool* allowed) {
- ContentSetting setting = host_content_settings_map_->GetCookieContentSetting(
- origin_url, top_origin_url, true);
- DCHECK((setting == CONTENT_SETTING_ALLOW) ||
- (setting == CONTENT_SETTING_BLOCK) ||
- (setting == CONTENT_SETTING_SESSION_ONLY));
- *allowed = setting != CONTENT_SETTING_BLOCK;
+ *allowed = cookie_content_settings_->Allow(origin_url, top_origin_url, true);
// Record access to file system for potential display in UI.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -480,10 +468,7 @@ void ChromeRenderMessageFilter::OnAllowIndexedDB(int render_view_id,
const GURL& top_origin_url,
const string16& name,
bool* allowed) {
- ContentSetting setting = host_content_settings_map_->GetCookieContentSetting(
- origin_url, top_origin_url, true);
- *allowed = setting != CONTENT_SETTING_BLOCK;
-
+ *allowed = cookie_content_settings_->Allow(origin_url, top_origin_url, true);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableFunction(

Powered by Google App Engine
This is Rietveld 408576698