Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 7049007: Origin Identifier Value Map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 rv = args->GetString(arg_i++, &pattern); 655 rv = args->GetString(arg_i++, &pattern);
656 DCHECK(rv); 656 DCHECK(rv);
657 657
658 HostContentSettingsMap* settings_map = 658 HostContentSettingsMap* settings_map =
659 mode == "normal" ? GetContentSettingsMap() : 659 mode == "normal" ? GetContentSettingsMap() :
660 GetOTRContentSettingsMap(); 660 GetOTRContentSettingsMap();
661 // The settings map could be null if the mode was OTR but the OTR profile 661 // The settings map could be null if the mode was OTR but the OTR profile
662 // got destroyed before we received this message. 662 // got destroyed before we received this message.
663 if (settings_map) { 663 if (settings_map) {
664 settings_map->SetContentSetting( 664 settings_map->SetContentSetting(
665 ContentSettingsPattern::LegacyFromString(pattern), 665 ContentSettingsPattern::FromString(pattern),
666 ContentSettingsTypeFromGroupName(type_string), 666 ContentSettingsTypeFromGroupName(type_string),
667 "", 667 "",
668 CONTENT_SETTING_DEFAULT); 668 CONTENT_SETTING_DEFAULT);
669 } 669 }
670 } 670 }
671 } 671 }
672 672
673 void ContentSettingsHandler::SetException(const ListValue* args) { 673 void ContentSettingsHandler::SetException(const ListValue* args) {
674 size_t arg_i = 0; 674 size_t arg_i = 0;
675 std::string type_string; 675 std::string type_string;
(...skipping 14 matching lines...) Expand all
690 690
691 HostContentSettingsMap* settings_map = 691 HostContentSettingsMap* settings_map =
692 mode == "normal" ? GetContentSettingsMap() : 692 mode == "normal" ? GetContentSettingsMap() :
693 GetOTRContentSettingsMap(); 693 GetOTRContentSettingsMap();
694 694
695 // The settings map could be null if the mode was OTR but the OTR profile 695 // The settings map could be null if the mode was OTR but the OTR profile
696 // got destroyed before we received this message. 696 // got destroyed before we received this message.
697 if (!settings_map) 697 if (!settings_map)
698 return; 698 return;
699 699
700 settings_map->SetContentSetting(ContentSettingsPattern::LegacyFromString( 700 settings_map->SetContentSetting(ContentSettingsPattern::FromString(
701 pattern), 701 pattern),
702 type, 702 type,
703 "", 703 "",
704 ContentSettingFromString(setting)); 704 ContentSettingFromString(setting));
705 } 705 }
706 706
707 void ContentSettingsHandler::CheckExceptionPatternValidity( 707 void ContentSettingsHandler::CheckExceptionPatternValidity(
708 const ListValue* args) { 708 const ListValue* args) {
709 size_t arg_i = 0; 709 size_t arg_i = 0;
710 Value* type; 710 Value* type;
711 CHECK(args->Get(arg_i++, &type)); 711 CHECK(args->Get(arg_i++, &type));
712 std::string mode_string; 712 std::string mode_string;
713 CHECK(args->GetString(arg_i++, &mode_string)); 713 CHECK(args->GetString(arg_i++, &mode_string));
714 std::string pattern_string; 714 std::string pattern_string;
715 CHECK(args->GetString(arg_i++, &pattern_string)); 715 CHECK(args->GetString(arg_i++, &pattern_string));
716 716
717 ContentSettingsPattern pattern = 717 ContentSettingsPattern pattern =
718 ContentSettingsPattern::LegacyFromString(pattern_string); 718 ContentSettingsPattern::FromString(pattern_string);
719 719
720 scoped_ptr<Value> mode_value(Value::CreateStringValue(mode_string)); 720 scoped_ptr<Value> mode_value(Value::CreateStringValue(mode_string));
721 scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string)); 721 scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string));
722 scoped_ptr<Value> valid_value(Value::CreateBooleanValue(pattern.IsValid())); 722 scoped_ptr<Value> valid_value(Value::CreateBooleanValue(pattern.IsValid()));
723 723
724 web_ui_->CallJavascriptFunction( 724 web_ui_->CallJavascriptFunction(
725 "ContentSettings.patternValidityCheckComplete", 725 "ContentSettings.patternValidityCheckComplete",
726 *type, 726 *type,
727 *mode_value.get(), 727 *mode_value.get(),
728 *pattern_value.get(), 728 *pattern_value.get(),
(...skipping 20 matching lines...) Expand all
749 return web_ui_->GetProfile()->GetProtocolHandlerRegistry(); 749 return web_ui_->GetProfile()->GetProtocolHandlerRegistry();
750 } 750 }
751 751
752 HostContentSettingsMap* 752 HostContentSettingsMap*
753 ContentSettingsHandler::GetOTRContentSettingsMap() { 753 ContentSettingsHandler::GetOTRContentSettingsMap() {
754 Profile* profile = web_ui_->GetProfile(); 754 Profile* profile = web_ui_->GetProfile();
755 if (profile->HasOffTheRecordProfile()) 755 if (profile->HasOffTheRecordProfile())
756 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); 756 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
757 return NULL; 757 return NULL;
758 } 758 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698