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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 ContentSettingsPattern::FromString(exception); | 92 ContentSettingsPattern::FromString(exception); |
93 host_content_settings_map_->SetContentSettingCustomScope( | 93 host_content_settings_map_->SetContentSettingCustomScope( |
94 pattern, pattern, content_type_, std::string(), content_settings); | 94 pattern, pattern, content_type_, std::string(), content_settings); |
95 } | 95 } |
96 | 96 |
97 // Wrapper to query GetWebsiteSetting(), and only return the source. | 97 // Wrapper to query GetWebsiteSetting(), and only return the source. |
98 content_settings::SettingSource GetSettingSourceForURL( | 98 content_settings::SettingSource GetSettingSourceForURL( |
99 const std::string& url_str) { | 99 const std::string& url_str) { |
100 GURL url(url_str); | 100 GURL url(url_str); |
101 content_settings::SettingInfo setting_info; | 101 content_settings::SettingInfo setting_info; |
102 scoped_ptr<base::Value> result = | 102 std::unique_ptr<base::Value> result = |
103 host_content_settings_map_->GetWebsiteSetting( | 103 host_content_settings_map_->GetWebsiteSetting( |
104 url, url, content_type_, std::string(), | 104 url, url, content_type_, std::string(), &setting_info); |
105 &setting_info); | |
106 return setting_info.source; | 105 return setting_info.source; |
107 }; | 106 }; |
108 | 107 |
109 private: | 108 private: |
110 syncable_prefs::TestingPrefServiceSyncable* prefs_; | 109 syncable_prefs::TestingPrefServiceSyncable* prefs_; |
111 HostContentSettingsMap* host_content_settings_map_; | 110 HostContentSettingsMap* host_content_settings_map_; |
112 ContentSettingsType content_type_; | 111 ContentSettingsType content_type_; |
113 const char* policy_default_setting_; | 112 const char* policy_default_setting_; |
114 | 113 |
115 DISALLOW_COPY_AND_ASSIGN(TesterForType); | 114 DISALLOW_COPY_AND_ASSIGN(TesterForType); |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); | 1312 host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); |
1314 | 1313 |
1315 // After migrating old settings, changes to the setting works. | 1314 // After migrating old settings, changes to the setting works. |
1316 host_content_settings_map->SetContentSettingDefaultScope( | 1315 host_content_settings_map->SetContentSettingDefaultScope( |
1317 host, GURL(), CONTENT_SETTINGS_TYPE_KEYGEN, std::string(), | 1316 host, GURL(), CONTENT_SETTINGS_TYPE_KEYGEN, std::string(), |
1318 CONTENT_SETTING_BLOCK); | 1317 CONTENT_SETTING_BLOCK); |
1319 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1318 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
1320 host_content_settings_map->GetContentSetting( | 1319 host_content_settings_map->GetContentSetting( |
1321 host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); | 1320 host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); |
1322 } | 1321 } |
OLD | NEW |