diff options
author | scheib <scheib@chromium.org> | 2014-10-24 20:03:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-25 03:03:54 +0000 |
commit | c9ba380c606442a025a38eb67f4d35c65b1a293c (patch) | |
tree | 51eb7373da2eaa5d38b04b484ec4725682a66fac /base/scoped_observer.h | |
parent | f3370050c1c1ee1e350d17dea653b3969779bbad (diff) | |
download | chromium_src-c9ba380c606442a025a38eb67f4d35c65b1a293c.zip chromium_src-c9ba380c606442a025a38eb67f4d35c65b1a293c.tar.gz chromium_src-c9ba380c606442a025a38eb67f4d35c65b1a293c.tar.bz2 |
Listen to Off The Record profiles in ContentSettingsHandler.
ContentSettingsHandler is now made aware of Off The Record profiles
and will observe them as well, correcting bugs where changes from the
settings webUI would function incorrectly.
This is a rework of a previously landed fix [fix] which was reverted due to
a crash bug [crash] when OTR profiles already existed before settings
were opened.
[fix] https://codereview.chromium.org/585953003
[crash] https://code.google.com/p/chromium/issues/detail?id=417597
BUG=425079, 418931
Review URL: https://codereview.chromium.org/676083003
Cr-Commit-Position: refs/heads/master@{#301273}
Diffstat (limited to 'base/scoped_observer.h')
-rw-r--r-- | base/scoped_observer.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/scoped_observer.h b/base/scoped_observer.h index 3754ed5..5b0d533 100644 --- a/base/scoped_observer.h +++ b/base/scoped_observer.h @@ -9,6 +9,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/logging.h" // ScopedObserver is used to keep track of the set of sources an object has // attached itself to as an observer. When ScopedObserver is destroyed it @@ -30,7 +31,9 @@ class ScopedObserver { // Remove the object passed to the constructor as an observer from |source|. void Remove(Source* source) { - sources_.erase(std::find(sources_.begin(), sources_.end(), source)); + auto it = std::find(sources_.begin(), sources_.end(), source); + DCHECK(it != sources_.end()); + sources_.erase(it); source->RemoveObserver(observer_); } |