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

Side by Side Diff: chrome/browser/tab_contents/tab_specific_content_settings.cc

Issue 3194005: Clear cookie related settings at the beginning of a navigation instead of at the end. (Closed)
Patch Set: Created 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" 5 #include "chrome/browser/tab_contents/tab_specific_content_settings.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browsing_data_appcache_helper.h" 8 #include "chrome/browser/browsing_data_appcache_helper.h"
9 #include "chrome/browser/browsing_data_database_helper.h" 9 #include "chrome/browser/browsing_data_database_helper.h"
10 #include "chrome/browser/browsing_data_local_storage_helper.h" 10 #include "chrome/browser/browsing_data_local_storage_helper.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 delegate_->OnContentSettingsAccessed(!allowed); 137 delegate_->OnContentSettingsAccessed(!allowed);
138 } 138 }
139 139
140 TabSpecificContentSettings::TabSpecificContentSettings( 140 TabSpecificContentSettings::TabSpecificContentSettings(
141 Delegate* delegate, Profile* profile) 141 Delegate* delegate, Profile* profile)
142 : allowed_local_shared_objects_(profile), 142 : allowed_local_shared_objects_(profile),
143 blocked_local_shared_objects_(profile), 143 blocked_local_shared_objects_(profile),
144 geolocation_settings_state_(profile), 144 geolocation_settings_state_(profile),
145 load_plugins_link_enabled_(true), 145 load_plugins_link_enabled_(true),
146 delegate_(NULL) { 146 delegate_(NULL) {
147 ClearBlockedContentSettings(); 147 ClearBlockedContentSettingsExceptForCookies();
148 ClearCookieSpecificContentSettings();
148 delegate_ = delegate; 149 delegate_ = delegate;
149 } 150 }
150 151
151 void TabSpecificContentSettings::ClearBlockedContentSettings() { 152 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() {
152 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { 153 for (size_t i = 0; i < arraysize(content_blocked_); ++i) {
154 if (i == CONTENT_SETTINGS_TYPE_COOKIES)
155 continue;
153 content_blocked_[i] = false; 156 content_blocked_[i] = false;
154 content_accessed_[i] = false; 157 content_accessed_[i] = false;
155 } 158 }
156 load_plugins_link_enabled_ = true; 159 load_plugins_link_enabled_ = true;
157 blocked_local_shared_objects_.Reset();
158 allowed_local_shared_objects_.Reset();
159 if (delegate_) 160 if (delegate_)
160 delegate_->OnContentSettingsAccessed(false); 161 delegate_->OnContentSettingsAccessed(false);
161 } 162 }
163
164 void TabSpecificContentSettings::ClearCookieSpecificContentSettings() {
165 blocked_local_shared_objects_.Reset();
166 allowed_local_shared_objects_.Reset();
167 content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false;
168 content_accessed_[CONTENT_SETTINGS_TYPE_COOKIES] = false;
169 if (delegate_)
170 delegate_->OnContentSettingsAccessed(false);
171 }
162 172
163 void TabSpecificContentSettings::SetPopupsBlocked(bool blocked) { 173 void TabSpecificContentSettings::SetPopupsBlocked(bool blocked) {
164 content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked; 174 content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked;
165 if (delegate_) 175 if (delegate_)
166 delegate_->OnContentSettingsAccessed(blocked); 176 delegate_->OnContentSettingsAccessed(blocked);
167 } 177 }
168 178
169 void TabSpecificContentSettings::GeolocationDidNavigate( 179 void TabSpecificContentSettings::GeolocationDidNavigate(
170 const NavigationController::LoadCommittedDetails& details) { 180 const NavigationController::LoadCommittedDetails& details) {
171 geolocation_settings_state_.DidNavigate(details); 181 geolocation_settings_state_.DidNavigate(details);
(...skipping 26 matching lines...) Expand all
198 databases_->Reset(); 208 databases_->Reset();
199 local_storages_->Reset(); 209 local_storages_->Reset();
200 session_storages_->Reset(); 210 session_storages_->Reset();
201 } 211 }
202 212
203 CookiesTreeModel* 213 CookiesTreeModel*
204 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { 214 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() {
205 return new CookiesTreeModel( 215 return new CookiesTreeModel(
206 cookies_, databases_, local_storages_, session_storages_, appcaches_); 216 cookies_, databases_, local_storages_, session_storages_, appcaches_);
207 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698