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

Side by Side Diff: chrome/browser/extensions/extension_content_settings_api.cc

Issue 8539004: Replace SetContentSetting method of the content_settings::Provider interface with GetWebsiteSetting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 1 month 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/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/cookie_settings.h"
13 #include "chrome/browser/content_settings/content_settings_utils.h"
13 #include "chrome/browser/content_settings/host_content_settings_map.h" 14 #include "chrome/browser/content_settings/host_content_settings_map.h"
14 #include "chrome/browser/extensions/extension_content_settings_api_constants.h" 15 #include "chrome/browser/extensions/extension_content_settings_api_constants.h"
15 #include "chrome/browser/extensions/extension_content_settings_helpers.h" 16 #include "chrome/browser/extensions/extension_content_settings_helpers.h"
16 #include "chrome/browser/extensions/extension_content_settings_store.h" 17 #include "chrome/browser/extensions/extension_content_settings_store.h"
17 #include "chrome/browser/extensions/extension_preference_api_constants.h" 18 #include "chrome/browser/extensions/extension_preference_api_constants.h"
18 #include "chrome/browser/extensions/extension_preference_helpers.h" 19 #include "chrome/browser/extensions/extension_preference_helpers.h"
19 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/extensions/extension_error_utils.h" 23 #include "chrome/common/extensions/extension_error_utils.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 cookie_settings = CookieSettings::GetForProfile(profile()); 148 cookie_settings = CookieSettings::GetForProfile(profile());
148 } 149 }
149 150
150 ContentSetting setting; 151 ContentSetting setting;
151 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { 152 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
152 // TODO(jochen): Do we return the value for setting or for reading cookies? 153 // TODO(jochen): Do we return the value for setting or for reading cookies?
153 bool setting_cookie = false; 154 bool setting_cookie = false;
154 setting = cookie_settings->GetCookieSetting(primary_url, secondary_url, 155 setting = cookie_settings->GetCookieSetting(primary_url, secondary_url,
155 setting_cookie, NULL); 156 setting_cookie, NULL);
156 } else { 157 } else {
157 setting = map->GetContentSetting(primary_url, secondary_url, content_type, 158 scoped_ptr<base::Value> value(
Bernhard Bauer 2011/11/11 14:00:40 Why this change? GetContentSetting is still availa
markusheintz_ 2011/11/14 11:15:10 Originally I planed to rm the SetContentSetting me
158 resource_identifier); 159 map->GetWebsiteSetting(primary_url, secondary_url, content_type,
160 resource_identifier, NULL));
161 setting = content_settings::ValueToContentSetting(value.get());
159 } 162 }
160 163
161 DictionaryValue* result = new DictionaryValue(); 164 DictionaryValue* result = new DictionaryValue();
162 result->SetString(keys::kContentSettingKey, 165 result->SetString(keys::kContentSettingKey,
163 helpers::ContentSettingToString(setting)); 166 helpers::ContentSettingToString(setting));
164 167
165 result_.reset(result); 168 result_.reset(result);
166 169
167 return true; 170 return true;
168 } 171 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 BrowserThread::PostTask( 301 BrowserThread::PostTask(
299 BrowserThread::UI, FROM_HERE, base::Bind( 302 BrowserThread::UI, FROM_HERE, base::Bind(
300 &GetResourceIdentifiersFunction::SendResponse, this, true)); 303 &GetResourceIdentifiersFunction::SendResponse, this, true));
301 } 304 }
302 305
303 // static 306 // static
304 void GetResourceIdentifiersFunction::SetPluginGroupsForTesting( 307 void GetResourceIdentifiersFunction::SetPluginGroupsForTesting(
305 const std::vector<webkit::npapi::PluginGroup>* plugin_groups) { 308 const std::vector<webkit::npapi::PluginGroup>* plugin_groups) {
306 g_testing_plugin_groups_ = plugin_groups; 309 g_testing_plugin_groups_ = plugin_groups;
307 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698