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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments. Threading fixes. Mac + win fixes. 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 5235b0a166693901be9d306c61ab589dd0486665..7017b6ff39d6547d012e3d5e9f2dd397fb1f02eb 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/chrome_plugin_message_filter.h"
#include "chrome/browser/chrome_quota_permission_context.h"
#include "chrome/browser/chrome_worker_message_filter.h"
+#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/download/download_util.h"
@@ -367,10 +368,8 @@ bool ChromeContentBrowserClient::AllowAppCache(
ProfileIOData* io_data =
reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
// FIXME(jochen): get the correct top-level origin.
- ContentSetting setting = io_data->GetHostContentSettingsMap()->
- GetCookieContentSetting(manifest_url, manifest_url, true);
- DCHECK(setting != CONTENT_SETTING_DEFAULT);
- return setting != CONTENT_SETTING_BLOCK;
+ return io_data->GetCookieSettings()->
+ IsSettingCookieAllowed(manifest_url, manifest_url);
}
bool ChromeContentBrowserClient::AllowGetCookie(
@@ -383,10 +382,8 @@ bool ChromeContentBrowserClient::AllowGetCookie(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProfileIOData* io_data =
reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
- ContentSetting setting = io_data->GetHostContentSettingsMap()->
- GetCookieContentSetting(url, first_party, false);
- bool allow = setting == CONTENT_SETTING_ALLOW ||
- setting == CONTENT_SETTING_SESSION_ONLY;
+ bool allow = io_data->GetCookieSettings()->
+ IsReadingCookieAllowed(url, first_party);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -407,14 +404,12 @@ bool ChromeContentBrowserClient::AllowSetCookie(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProfileIOData* io_data =
reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
- ContentSetting setting = io_data->GetHostContentSettingsMap()->
- GetCookieContentSetting(url, first_party, true);
- if (setting == CONTENT_SETTING_SESSION_ONLY)
- options->set_force_session();
+ CookieSettings* cookie_settings = io_data->GetCookieSettings();
+ bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party);
- bool allow = setting == CONTENT_SETTING_ALLOW ||
- setting == CONTENT_SETTING_SESSION_ONLY;
+ if (cookie_settings->IsCookieSessionOnly(url))
+ options->set_force_session();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
« no previous file with comments | « no previous file | chrome/browser/chrome_worker_message_filter.h » ('j') | chrome/browser/content_settings/cookie_settings.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698