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

Unified Diff: chrome/browser/blocked_popup_container.cc

Issue 434109: Don't save popup blocker whitelist modifications performed while off the reco... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/blocked_popup_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/blocked_popup_container.cc
===================================================================
--- chrome/browser/blocked_popup_container.cc (revision 33109)
+++ chrome/browser/blocked_popup_container.cc (working copy)
@@ -155,11 +155,8 @@
bool should_whitelist = !i->second;
popup_hosts_[host] = should_whitelist;
- ListValue* whitelist_pref =
- prefs_->GetMutableList(prefs::kPopupWhitelistedHosts);
if (should_whitelist) {
whitelist_.insert(host);
- whitelist_pref->Append(new StringValue(host));
// Open the popups in order.
for (size_t j = 0; j < blocked_popups_.size();) {
@@ -171,8 +168,6 @@
} else {
// Remove from whitelist.
whitelist_.erase(host);
- StringValue host_as_string(host);
- whitelist_pref->Remove(host_as_string);
for (UnblockedPopups::iterator i(unblocked_popups_.begin());
i != unblocked_popups_.end(); ) {
@@ -197,6 +192,21 @@
}
}
}
+
+ // Persist whitelisting state if we're not off the record.
+ if (prefs_) {
+ ListValue* whitelist_pref =
+ prefs_->GetMutableList(prefs::kPopupWhitelistedHosts);
+ if (should_whitelist) {
+ whitelist_pref->Append(new StringValue(host));
+ } else {
+ // Stupidly, gcc complains that you're accessing the (private) StringValue
+ // copy constructor if you inline the temp creation into the Remove()
+ // call.
+ StringValue host_value(host);
+ whitelist_pref->Remove(host_value);
+ }
+ }
}
void BlockedPopupContainer::CloseAll() {
@@ -391,14 +401,17 @@
const ListValue* whitelist_pref =
prefs_->GetList(prefs::kPopupWhitelistedHosts);
// Careful: The returned value could be NULL if the pref has never been set.
- if (whitelist_pref == NULL)
- return;
- for (ListValue::const_iterator i(whitelist_pref->begin());
- i != whitelist_pref->end(); ++i) {
- std::string host;
- (*i)->GetAsString(&host);
- whitelist_.insert(host);
+ if (whitelist_pref != NULL) {
+ for (ListValue::const_iterator i(whitelist_pref->begin());
+ i != whitelist_pref->end(); ++i) {
+ std::string host;
+ (*i)->GetAsString(&host);
+ whitelist_.insert(host);
+ }
}
+
+ if (profile->IsOffTheRecord())
+ prefs_ = NULL; // Don't persist any zoom levels.
Elliot Glaysher 2009/11/30 17:39:13 I assume this comment was copy/pasted?
}
void BlockedPopupContainer::UpdateView() {
« no previous file with comments | « chrome/browser/blocked_popup_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698