OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 else | 520 else |
521 UpdateExceptionsViewFromModel(details.type()); | 521 UpdateExceptionsViewFromModel(details.type()); |
522 } | 522 } |
523 | 523 |
524 void ContentSettingsHandler::Observe( | 524 void ContentSettingsHandler::Observe( |
525 int type, | 525 int type, |
526 const content::NotificationSource& source, | 526 const content::NotificationSource& source, |
527 const content::NotificationDetails& details) { | 527 const content::NotificationDetails& details) { |
528 switch (type) { | 528 switch (type) { |
529 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 529 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
530 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { | 530 Profile* profile = content::Source<Profile>(source).ptr(); |
| 531 if (profile->IsOffTheRecord()) { |
531 web_ui()->CallJavascriptFunction( | 532 web_ui()->CallJavascriptFunction( |
532 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); | 533 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); |
| 534 observer_.Remove(profile->GetHostContentSettingsMap()); |
533 } | 535 } |
534 break; | 536 break; |
535 } | 537 } |
536 | 538 |
537 case chrome::NOTIFICATION_PROFILE_CREATED: { | 539 case chrome::NOTIFICATION_PROFILE_CREATED: { |
538 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) | 540 Profile* profile = content::Source<Profile>(source).ptr(); |
| 541 if (profile->IsOffTheRecord()) { |
539 UpdateAllOTRExceptionsViewsFromModel(); | 542 UpdateAllOTRExceptionsViewsFromModel(); |
| 543 observer_.Add(profile->GetHostContentSettingsMap()); |
| 544 } |
540 break; | 545 break; |
541 } | 546 } |
542 | 547 |
543 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { | 548 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { |
544 UpdateNotificationExceptionsView(); | 549 UpdateNotificationExceptionsView(); |
545 break; | 550 break; |
546 } | 551 } |
547 | 552 |
548 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { | 553 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { |
549 UpdateHandlersEnabledRadios(); | 554 UpdateHandlersEnabledRadios(); |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1497 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
1493 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1498 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1494 // Exceptions apply only when the feature is enabled. | 1499 // Exceptions apply only when the feature is enabled. |
1495 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1500 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1496 web_ui()->CallJavascriptFunction( | 1501 web_ui()->CallJavascriptFunction( |
1497 "ContentSettings.enableProtectedContentExceptions", | 1502 "ContentSettings.enableProtectedContentExceptions", |
1498 base::FundamentalValue(enable_exceptions)); | 1503 base::FundamentalValue(enable_exceptions)); |
1499 } | 1504 } |
1500 | 1505 |
1501 } // namespace options | 1506 } // namespace options |
OLD | NEW |