| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 15 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 16 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co
nstants.h" | 17 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co
nstants.h" |
| 17 #include "chrome/browser/extensions/api/content_settings/content_settings_helper
s.h" | 18 #include "chrome/browser/extensions/api/content_settings/content_settings_helper
s.h" |
| 18 #include "chrome/browser/extensions/api/content_settings/content_settings_servic
e.h" | 19 #include "chrome/browser/extensions/api/content_settings/content_settings_servic
e.h" |
| 19 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" | 20 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
| 20 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" | 21 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" |
| 21 #include "chrome/browser/extensions/api/preference/preference_helpers.h" | 22 #include "chrome/browser/extensions/api/preference/preference_helpers.h" |
| 22 #include "chrome/browser/plugins/plugin_finder.h" | 23 #include "chrome/browser/plugins/plugin_finder.h" |
| 23 #include "chrome/browser/plugins/plugin_installer.h" | 24 #include "chrome/browser/plugins/plugin_installer.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 135 |
| 135 HostContentSettingsMap* map; | 136 HostContentSettingsMap* map; |
| 136 content_settings::CookieSettings* cookie_settings; | 137 content_settings::CookieSettings* cookie_settings; |
| 137 if (incognito) { | 138 if (incognito) { |
| 138 if (!GetProfile()->HasOffTheRecordProfile()) { | 139 if (!GetProfile()->HasOffTheRecordProfile()) { |
| 139 // TODO(bauerb): Allow reading incognito content settings | 140 // TODO(bauerb): Allow reading incognito content settings |
| 140 // outside of an incognito session. | 141 // outside of an incognito session. |
| 141 error_ = keys::kIncognitoSessionOnlyError; | 142 error_ = keys::kIncognitoSessionOnlyError; |
| 142 return false; | 143 return false; |
| 143 } | 144 } |
| 144 map = GetProfile()->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 145 map = HostContentSettingsMapFactory::GetForProfile( |
| 146 GetProfile()->GetOffTheRecordProfile()); |
| 145 cookie_settings = CookieSettingsFactory::GetForProfile( | 147 cookie_settings = CookieSettingsFactory::GetForProfile( |
| 146 GetProfile()->GetOffTheRecordProfile()).get(); | 148 GetProfile()->GetOffTheRecordProfile()).get(); |
| 147 } else { | 149 } else { |
| 148 map = GetProfile()->GetHostContentSettingsMap(); | 150 map = HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 149 cookie_settings = CookieSettingsFactory::GetForProfile(GetProfile()).get(); | 151 cookie_settings = CookieSettingsFactory::GetForProfile(GetProfile()).get(); |
| 150 } | 152 } |
| 151 | 153 |
| 152 ContentSetting setting; | 154 ContentSetting setting; |
| 153 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { | 155 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { |
| 154 // TODO(jochen): Do we return the value for setting or for reading cookies? | 156 // TODO(jochen): Do we return the value for setting or for reading cookies? |
| 155 bool setting_cookie = false; | 157 bool setting_cookie = false; |
| 156 setting = cookie_settings->GetCookieSetting(primary_url, secondary_url, | 158 setting = cookie_settings->GetCookieSetting(primary_url, secondary_url, |
| 157 setting_cookie, NULL); | 159 setting_cookie, NULL); |
| 158 } else { | 160 } else { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 SetResult(list); | 319 SetResult(list); |
| 318 BrowserThread::PostTask( | 320 BrowserThread::PostTask( |
| 319 BrowserThread::UI, FROM_HERE, base::Bind( | 321 BrowserThread::UI, FROM_HERE, base::Bind( |
| 320 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: | 322 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: |
| 321 SendResponse, | 323 SendResponse, |
| 322 this, | 324 this, |
| 323 true)); | 325 true)); |
| 324 } | 326 } |
| 325 | 327 |
| 326 } // namespace extensions | 328 } // namespace extensions |
| OLD | NEW |