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

Unified Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 7355025: Creat BrowsingDataCookieHelper and CannedBrowsingDataCookieHelper for logging cookies at UI thread. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
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/content_settings/tab_specific_content_settings.cc
===================================================================
--- chrome/browser/content_settings/tab_specific_content_settings.cc (revision 95818)
+++ chrome/browser/content_settings/tab_specific_content_settings.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/lazy_instance.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browsing_data_appcache_helper.h"
+#include "chrome/browser/browsing_data_cookie_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
#include "chrome/browser/browsing_data_file_system_helper.h"
#include "chrome/browser/browsing_data_indexed_db_helper.h"
@@ -26,7 +27,6 @@
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
-#include "net/base/cookie_monster.h"
#include "webkit/fileapi/file_system_types.h"
namespace {
@@ -36,8 +36,8 @@
}
bool TabSpecificContentSettings::LocalSharedObjectsContainer::empty() const {
- return cookies_->GetAllCookies().empty() &&
- appcaches_->empty() &&
+ return appcaches_->empty() &&
+ cookies_->empty() &&
databases_->empty() &&
file_systems_->empty() &&
indexed_dbs_->empty() &&
@@ -239,24 +239,15 @@
bool blocked_by_policy) {
if (cookie_list.empty())
return;
- LocalSharedObjectsContainer& container = blocked_by_policy ?
- blocked_local_shared_objects_ : allowed_local_shared_objects_;
- typedef net::CookieList::const_iterator cookie_iterator;
- for (cookie_iterator cookie = cookie_list.begin();
- cookie != cookie_list.end(); ++cookie) {
- container.cookies()->SetCookieWithDetails(url,
- cookie->Name(),
- cookie->Value(),
- cookie->Domain(),
- cookie->Path(),
- cookie->ExpiryDate(),
- cookie->IsSecure(),
- cookie->IsHttpOnly());
- }
- if (blocked_by_policy)
+ if (blocked_by_policy) {
+ blocked_local_shared_objects_.cookies()->AddReadCookies(
+ url, cookie_list);
OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
- else
+ } else {
+ allowed_local_shared_objects_.cookies()->AddReadCookies(
+ url, cookie_list);
OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
+ }
}
void TabSpecificContentSettings::OnCookieChanged(
@@ -265,11 +256,11 @@
const net::CookieOptions& options,
bool blocked_by_policy) {
if (blocked_by_policy) {
- blocked_local_shared_objects_.cookies()->SetCookieWithOptions(
+ blocked_local_shared_objects_.cookies()->AddChangedCookie(
url, cookie_line, options);
OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
} else {
- allowed_local_shared_objects_.cookies()->SetCookieWithOptions(
+ allowed_local_shared_objects_.cookies()->AddChangedCookie(
url, cookie_line, options);
OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
}
@@ -486,17 +477,13 @@
TabSpecificContentSettings::LocalSharedObjectsContainer::
LocalSharedObjectsContainer(Profile* profile)
- : cookies_(new net::CookieMonster(NULL, NULL)),
- appcaches_(new CannedBrowsingDataAppCacheHelper(profile)),
+ : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)),
+ cookies_(new CannedBrowsingDataCookieHelper(profile)),
databases_(new CannedBrowsingDataDatabaseHelper(profile)),
file_systems_(new CannedBrowsingDataFileSystemHelper(profile)),
indexed_dbs_(new CannedBrowsingDataIndexedDBHelper(profile)),
local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)),
session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) {
- cookies_->SetCookieableSchemes(
- net::CookieMonster::kDefaultCookieableSchemes,
- net::CookieMonster::kDefaultCookieableSchemesCount);
- cookies_->SetKeepExpiredCookies();
}
TabSpecificContentSettings::LocalSharedObjectsContainer::
@@ -504,12 +491,8 @@
}
void TabSpecificContentSettings::LocalSharedObjectsContainer::Reset() {
- cookies_ = new net::CookieMonster(NULL, NULL);
- cookies_->SetCookieableSchemes(
- net::CookieMonster::kDefaultCookieableSchemes,
- net::CookieMonster::kDefaultCookieableSchemesCount);
- cookies_->SetKeepExpiredCookies();
appcaches_->Reset();
+ cookies_->Reset();
databases_->Reset();
file_systems_->Reset();
indexed_dbs_->Reset();
@@ -519,7 +502,7 @@
CookiesTreeModel*
TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() {
- return new CookiesTreeModel(cookies_,
+ return new CookiesTreeModel(cookies_->Clone(),
databases_->Clone(),
local_storages_->Clone(),
session_storages_->Clone(),
« no previous file with comments | « chrome/browser/content_settings/tab_specific_content_settings.h ('k') | chrome/browser/cookies_tree_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698