| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 474 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 475 std::string(), | 475 std::string(), |
| 476 &all_settings); | 476 &all_settings); |
| 477 | 477 |
| 478 // Group geolocation settings by primary_pattern. | 478 // Group geolocation settings by primary_pattern. |
| 479 AllPatternsSettings all_patterns_settings; | 479 AllPatternsSettings all_patterns_settings; |
| 480 for (ContentSettingsForOneType::iterator i = | 480 for (ContentSettingsForOneType::iterator i = |
| 481 all_settings.begin(); | 481 all_settings.begin(); |
| 482 i != all_settings.end(); | 482 i != all_settings.end(); |
| 483 ++i) { | 483 ++i) { |
| 484 // Don't add default settings. |
| 485 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && |
| 486 i->secondary_pattern == ContentSettingsPattern::Wildcard() && |
| 487 i->source != "preferences") { |
| 488 continue; |
| 489 } |
| 484 all_patterns_settings[i->primary_pattern][i->secondary_pattern] = | 490 all_patterns_settings[i->primary_pattern][i->secondary_pattern] = |
| 485 i->setting; | 491 i->setting; |
| 486 } | 492 } |
| 487 | 493 |
| 488 ListValue exceptions; | 494 ListValue exceptions; |
| 489 for (AllPatternsSettings::iterator i = all_patterns_settings.begin(); | 495 for (AllPatternsSettings::iterator i = all_patterns_settings.begin(); |
| 490 i != all_patterns_settings.end(); | 496 i != all_patterns_settings.end(); |
| 491 ++i) { | 497 ++i) { |
| 492 const ContentSettingsPattern& primary_pattern = i->first; | 498 const ContentSettingsPattern& primary_pattern = i->first; |
| 493 const OnePatternSettings& one_settings = i->second; | 499 const OnePatternSettings& one_settings = i->second; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 DesktopNotificationServiceFactory::GetForProfile(profile); | 537 DesktopNotificationServiceFactory::GetForProfile(profile); |
| 532 | 538 |
| 533 ContentSettingsForOneType settings; | 539 ContentSettingsForOneType settings; |
| 534 service->GetNotificationsSettings(&settings); | 540 service->GetNotificationsSettings(&settings); |
| 535 | 541 |
| 536 ListValue exceptions; | 542 ListValue exceptions; |
| 537 for (ContentSettingsForOneType::const_iterator i = | 543 for (ContentSettingsForOneType::const_iterator i = |
| 538 settings.begin(); | 544 settings.begin(); |
| 539 i != settings.end(); | 545 i != settings.end(); |
| 540 ++i) { | 546 ++i) { |
| 547 // Don't add default settings. |
| 548 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && |
| 549 i->secondary_pattern == ContentSettingsPattern::Wildcard() && |
| 550 i->source != "preferences") { |
| 551 continue; |
| 552 } |
| 553 |
| 541 exceptions.Append( | 554 exceptions.Append( |
| 542 GetNotificationExceptionForPage(i->primary_pattern, i->setting, | 555 GetNotificationExceptionForPage(i->primary_pattern, i->setting, |
| 543 i->source)); | 556 i->source)); |
| 544 } | 557 } |
| 545 | 558 |
| 546 StringValue type_string( | 559 StringValue type_string( |
| 547 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS)); | 560 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS)); |
| 548 web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", | 561 web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", |
| 549 type_string, exceptions); | 562 type_string, exceptions); |
| 550 | 563 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 819 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
| 807 } | 820 } |
| 808 | 821 |
| 809 HostContentSettingsMap* | 822 HostContentSettingsMap* |
| 810 ContentSettingsHandler::GetOTRContentSettingsMap() { | 823 ContentSettingsHandler::GetOTRContentSettingsMap() { |
| 811 Profile* profile = Profile::FromWebUI(web_ui_); | 824 Profile* profile = Profile::FromWebUI(web_ui_); |
| 812 if (profile->HasOffTheRecordProfile()) | 825 if (profile->HasOffTheRecordProfile()) |
| 813 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 826 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
| 814 return NULL; | 827 return NULL; |
| 815 } | 828 } |
| OLD | NEW |