Chromium Code Reviews| Index: chrome/browser/ui/webui/options/content_settings_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc |
| index 48a875150ee7871f9209446f454748cd9b1909b0..e7edeef96e5da3773c77f3b461010352aa865d82 100644 |
| --- a/chrome/browser/ui/webui/options/content_settings_handler.cc |
| +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc |
| @@ -497,7 +497,13 @@ void ContentSettingsHandler::InitializeHandler() { |
| base::Unretained(this))); |
| flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context)); |
| - observer_.Add(Profile::FromWebUI(web_ui())->GetHostContentSettingsMap()); |
| + |
| + Profile* profile = Profile::FromWebUI(web_ui()); |
| + observer_.Add(profile->GetHostContentSettingsMap()); |
| + if (profile->HasOffTheRecordProfile()) { |
| + observer_.Add( |
| + profile->GetOffTheRecordProfile()->GetHostContentSettingsMap()); |
| + } |
| } |
| void ContentSettingsHandler::InitializePage() { |
| @@ -529,16 +535,21 @@ void ContentSettingsHandler::Observe( |
| const content::NotificationDetails& details) { |
| switch (type) { |
| case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
| - if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { |
| + Profile* profile = content::Source<Profile>(source).ptr(); |
| + if (profile->IsOffTheRecord()) { |
| web_ui()->CallJavascriptFunction( |
| "ContentSettingsExceptionsArea.OTRProfileDestroyed"); |
| + observer_.Remove(profile->GetHostContentSettingsMap()); |
|
Lei Zhang
2014/10/24 19:57:29
Can't we potentially failed the newly added DCHECK
scheib
2014/10/24 21:46:19
Good catch. I've added a check.
|
| } |
| break; |
| } |
| case chrome::NOTIFICATION_PROFILE_CREATED: { |
| - if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) |
| + Profile* profile = content::Source<Profile>(source).ptr(); |
| + if (profile->IsOffTheRecord()) { |
| UpdateAllOTRExceptionsViewsFromModel(); |
| + observer_.Add(profile->GetHostContentSettingsMap()); |
| + } |
| break; |
| } |