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/extensions/extension_content_settings_api.h" | 5 #include "chrome/browser/extensions/extension_content_settings_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/content_settings/cookie_settings.h" | |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/extensions/extension_content_settings_api_constants.h" | 14 #include "chrome/browser/extensions/extension_content_settings_api_constants.h" |
14 #include "chrome/browser/extensions/extension_content_settings_helpers.h" | 15 #include "chrome/browser/extensions/extension_content_settings_helpers.h" |
15 #include "chrome/browser/extensions/extension_content_settings_store.h" | 16 #include "chrome/browser/extensions/extension_content_settings_store.h" |
16 #include "chrome/browser/extensions/extension_preference_api_constants.h" | 17 #include "chrome/browser/extensions/extension_preference_api_constants.h" |
17 #include "chrome/browser/extensions/extension_preference_helpers.h" | 18 #include "chrome/browser/extensions/extension_preference_helpers.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/extension_error_utils.h" | 22 #include "chrome/common/extensions/extension_error_utils.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 } | 138 } |
138 map = profile()->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 139 map = profile()->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
139 } else { | 140 } else { |
140 map = profile()->GetHostContentSettingsMap(); | 141 map = profile()->GetHostContentSettingsMap(); |
141 } | 142 } |
142 | 143 |
143 ContentSetting setting; | 144 ContentSetting setting; |
144 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { | 145 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { |
145 // TODO(jochen): Do we return the value for setting or for reading cookies? | 146 // TODO(jochen): Do we return the value for setting or for reading cookies? |
146 bool setting_cookie = false; | 147 bool setting_cookie = false; |
147 setting = map->GetCookieContentSetting(primary_url, secondary_url, | 148 if (map->GetCookieSettings()->IsCookieAllowed(primary_url, secondary_url, |
148 setting_cookie); | 149 setting_cookie)) { |
Bernhard Bauer
2011/08/28 19:18:49
Nit: indent
marja
2011/09/01 11:03:19
Done.
| |
150 setting = CONTENT_SETTING_ALLOW; | |
151 } else { | |
152 setting = CONTENT_SETTING_BLOCK; | |
153 } | |
149 } else { | 154 } else { |
150 setting = map->GetContentSetting(primary_url, secondary_url, content_type, | 155 setting = map->GetContentSetting(primary_url, secondary_url, content_type, |
151 resource_identifier); | 156 resource_identifier); |
152 } | 157 } |
153 | 158 |
154 DictionaryValue* result = new DictionaryValue(); | 159 DictionaryValue* result = new DictionaryValue(); |
155 result->SetString(keys::kContentSettingKey, | 160 result->SetString(keys::kContentSettingKey, |
156 helpers::ContentSettingToString(setting)); | 161 helpers::ContentSettingToString(setting)); |
157 | 162 |
158 result_.reset(result); | 163 result_.reset(result); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 BrowserThread::PostTask( | 303 BrowserThread::PostTask( |
299 BrowserThread::UI, FROM_HERE, base::Bind( | 304 BrowserThread::UI, FROM_HERE, base::Bind( |
300 &GetResourceIdentifiersFunction::SendResponse, this, true)); | 305 &GetResourceIdentifiersFunction::SendResponse, this, true)); |
301 } | 306 } |
302 | 307 |
303 // static | 308 // static |
304 void GetResourceIdentifiersFunction::SetPluginListForTesting( | 309 void GetResourceIdentifiersFunction::SetPluginListForTesting( |
305 webkit::npapi::PluginList* plugin_list) { | 310 webkit::npapi::PluginList* plugin_list) { |
306 g_plugin_list = plugin_list; | 311 g_plugin_list = plugin_list; |
307 } | 312 } |
OLD | NEW |