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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 default_setting(CONTENT_SETTING_DEFAULT), | 261 default_setting(CONTENT_SETTING_DEFAULT), |
262 policy_disable_audio(false), | 262 policy_disable_audio(false), |
263 policy_disable_video(false), | 263 policy_disable_video(false), |
264 default_setting_initialized(false), | 264 default_setting_initialized(false), |
265 exceptions_initialized(false) { | 265 exceptions_initialized(false) { |
266 } | 266 } |
267 | 267 |
268 ContentSettingsHandler::MediaSettingsInfo::~MediaSettingsInfo() { | 268 ContentSettingsHandler::MediaSettingsInfo::~MediaSettingsInfo() { |
269 } | 269 } |
270 | 270 |
271 ContentSettingsHandler::ContentSettingsHandler() : observer_(this) { | 271 ContentSettingsHandler::ContentSettingsHandler() |
272 : observer_(this), otr_observer_(this) { | |
272 } | 273 } |
273 | 274 |
274 ContentSettingsHandler::~ContentSettingsHandler() { | 275 ContentSettingsHandler::~ContentSettingsHandler() { |
275 } | 276 } |
276 | 277 |
277 void ContentSettingsHandler::GetLocalizedValues( | 278 void ContentSettingsHandler::GetLocalizedValues( |
278 base::DictionaryValue* localized_strings) { | 279 base::DictionaryValue* localized_strings) { |
279 DCHECK(localized_strings); | 280 DCHECK(localized_strings); |
280 | 281 |
281 // TODO(dhnishi): Standardize to lowerCamelCase. | 282 // TODO(dhnishi): Standardize to lowerCamelCase. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 else | 521 else |
521 UpdateExceptionsViewFromModel(details.type()); | 522 UpdateExceptionsViewFromModel(details.type()); |
522 } | 523 } |
523 | 524 |
524 void ContentSettingsHandler::Observe( | 525 void ContentSettingsHandler::Observe( |
525 int type, | 526 int type, |
526 const content::NotificationSource& source, | 527 const content::NotificationSource& source, |
527 const content::NotificationDetails& details) { | 528 const content::NotificationDetails& details) { |
528 switch (type) { | 529 switch (type) { |
529 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 530 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
530 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { | 531 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { |
Bernhard Bauer
2014/09/19 18:18:50
Do we want to stop observing the OTR profile in th
Daniel Nishi
2014/09/19 19:49:15
Done.
| |
531 web_ui()->CallJavascriptFunction( | 532 web_ui()->CallJavascriptFunction( |
532 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); | 533 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); |
533 } | 534 } |
534 break; | 535 break; |
535 } | 536 } |
536 | 537 |
537 case chrome::NOTIFICATION_PROFILE_CREATED: { | 538 case chrome::NOTIFICATION_PROFILE_CREATED: { |
538 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) | 539 Profile* profile = content::Source<Profile>(source).ptr(); |
540 if (profile->IsOffTheRecord()) { | |
539 UpdateAllOTRExceptionsViewsFromModel(); | 541 UpdateAllOTRExceptionsViewsFromModel(); |
542 | |
543 if (profile->GetOriginalProfile() != profile) | |
Bernhard Bauer
2014/09/19 18:18:50
In what super fun special case is the original pro
Daniel Nishi
2014/09/19 19:49:15
It actually looks like the Guest Mode case is more
| |
544 otr_observer_.Add(profile->GetHostContentSettingsMap()); | |
545 } | |
540 break; | 546 break; |
541 } | 547 } |
542 | 548 |
543 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { | 549 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { |
544 UpdateNotificationExceptionsView(); | 550 UpdateNotificationExceptionsView(); |
545 break; | 551 break; |
546 } | 552 } |
547 | 553 |
548 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { | 554 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { |
549 UpdateHandlersEnabledRadios(); | 555 UpdateHandlersEnabledRadios(); |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1498 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
1493 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1499 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1494 // Exceptions apply only when the feature is enabled. | 1500 // Exceptions apply only when the feature is enabled. |
1495 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1501 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1496 web_ui()->CallJavascriptFunction( | 1502 web_ui()->CallJavascriptFunction( |
1497 "ContentSettings.enableProtectedContentExceptions", | 1503 "ContentSettings.enableProtectedContentExceptions", |
1498 base::FundamentalValue(enable_exceptions)); | 1504 base::FundamentalValue(enable_exceptions)); |
1499 } | 1505 } |
1500 | 1506 |
1501 } // namespace options | 1507 } // namespace options |
OLD | NEW |