| 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 Profile* profile = content::Source<Profile>(source).ptr(); | 530 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { |
| 531 if (profile->IsOffTheRecord()) { | |
| 532 web_ui()->CallJavascriptFunction( | 531 web_ui()->CallJavascriptFunction( |
| 533 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); | 532 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); |
| 534 observer_.Remove(profile->GetHostContentSettingsMap()); | |
| 535 } | 533 } |
| 536 break; | 534 break; |
| 537 } | 535 } |
| 538 | 536 |
| 539 case chrome::NOTIFICATION_PROFILE_CREATED: { | 537 case chrome::NOTIFICATION_PROFILE_CREATED: { |
| 540 Profile* profile = content::Source<Profile>(source).ptr(); | 538 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) |
| 541 if (profile->IsOffTheRecord()) { | |
| 542 UpdateAllOTRExceptionsViewsFromModel(); | 539 UpdateAllOTRExceptionsViewsFromModel(); |
| 543 observer_.Add(profile->GetHostContentSettingsMap()); | |
| 544 } | |
| 545 break; | 540 break; |
| 546 } | 541 } |
| 547 | 542 |
| 548 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { | 543 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { |
| 549 UpdateNotificationExceptionsView(); | 544 UpdateNotificationExceptionsView(); |
| 550 break; | 545 break; |
| 551 } | 546 } |
| 552 | 547 |
| 553 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { | 548 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { |
| 554 UpdateHandlersEnabledRadios(); | 549 UpdateHandlersEnabledRadios(); |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 | 1498 |
| 1504 // Exceptions apply only when the feature is enabled. | 1499 // Exceptions apply only when the feature is enabled. |
| 1505 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1500 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1506 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1501 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1507 web_ui()->CallJavascriptFunction( | 1502 web_ui()->CallJavascriptFunction( |
| 1508 "ContentSettings.enableProtectedContentExceptions", | 1503 "ContentSettings.enableProtectedContentExceptions", |
| 1509 base::FundamentalValue(enable_exceptions)); | 1504 base::FundamentalValue(enable_exceptions)); |
| 1510 } | 1505 } |
| 1511 | 1506 |
| 1512 } // namespace options | 1507 } // namespace options |
| OLD | NEW |