| 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/extensions/api/content_settings/content_settings_api.h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 cookie_settings = | 146 cookie_settings = |
| 147 CookieSettingsFactory::GetForProfile(profile->GetOffTheRecordProfile()) | 147 CookieSettingsFactory::GetForProfile(profile->GetOffTheRecordProfile()) |
| 148 .get(); | 148 .get(); |
| 149 } else { | 149 } else { |
| 150 map = HostContentSettingsMapFactory::GetForProfile(profile); | 150 map = HostContentSettingsMapFactory::GetForProfile(profile); |
| 151 cookie_settings = CookieSettingsFactory::GetForProfile(profile).get(); | 151 cookie_settings = CookieSettingsFactory::GetForProfile(profile).get(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 ContentSetting setting; | 154 ContentSetting setting; |
| 155 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { | 155 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { |
| 156 // TODO(jochen): Do we return the value for setting or for reading cookies? | |
| 157 cookie_settings->GetCookieSetting(primary_url, secondary_url, nullptr, | 156 cookie_settings->GetCookieSetting(primary_url, secondary_url, nullptr, |
| 158 nullptr /* reading_setting */, &setting); | 157 &setting); |
| 159 } else { | 158 } else { |
| 160 setting = map->GetContentSetting(primary_url, secondary_url, content_type, | 159 setting = map->GetContentSetting(primary_url, secondary_url, content_type, |
| 161 resource_identifier); | 160 resource_identifier); |
| 162 } | 161 } |
| 163 | 162 |
| 164 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 163 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
| 165 std::string setting_string = | 164 std::string setting_string = |
| 166 content_settings::ContentSettingToString(setting); | 165 content_settings::ContentSettingToString(setting); |
| 167 DCHECK(!setting_string.empty()); | 166 DCHECK(!setting_string.empty()); |
| 168 result->SetString(keys::kContentSettingKey, setting_string); | 167 result->SetString(keys::kContentSettingKey, setting_string); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 SetResult(std::move(list)); | 308 SetResult(std::move(list)); |
| 310 BrowserThread::PostTask( | 309 BrowserThread::PostTask( |
| 311 BrowserThread::UI, FROM_HERE, base::Bind( | 310 BrowserThread::UI, FROM_HERE, base::Bind( |
| 312 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: | 311 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: |
| 313 SendResponse, | 312 SendResponse, |
| 314 this, | 313 this, |
| 315 true)); | 314 true)); |
| 316 } | 315 } |
| 317 | 316 |
| 318 } // namespace extensions | 317 } // namespace extensions |
| OLD | NEW |