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

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: Code review comments. 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 8cab495181c09f10f54e9058af956182ac3718bc..ebd7d3d19e8ca918fadaa5b3221aef7e35616a0d 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -8,6 +8,8 @@
#include "base/metrics/histogram.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/content_settings/cookie_settings.h"
+#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/extensions/extension_event_router.h"
@@ -416,13 +418,8 @@ 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 = CookieSettingsFactory::GetForProfile(profile_)->
+ IsSettingCookieAllowed(origin_url, top_origin_url);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableFunction(
@@ -436,9 +433,8 @@ 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 = CookieSettingsFactory::GetForProfile(profile_)->
+ IsSettingCookieAllowed(origin_url, top_origin_url);
// Record access to DOM storage for potential display in UI.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -451,12 +447,8 @@ 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 = CookieSettingsFactory::GetForProfile(profile_)->
+ IsSettingCookieAllowed(origin_url, top_origin_url);
// Record access to file system for potential display in UI.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -470,10 +462,8 @@ 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 = CookieSettingsFactory::GetForProfile(profile_)->
+ IsSettingCookieAllowed(origin_url, top_origin_url);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableFunction(

Powered by Google App Engine
This is Rietveld 408576698