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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_api.cc

Issue 2502743003: Allow getting both reading/setting cookie settings at one time (Closed)
Patch Set: small refactor to avoid a few branches Created 4 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
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
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? 156 // TODO(jochen): Do we return the value for setting or for reading cookies?
157 bool setting_cookie = false; 157 cookie_settings->GetCookieSetting(primary_url, secondary_url, NULL,
Bernhard Bauer 2016/11/16 16:55:45 While you're here, use nullptr instead of NULL?
Charlie Harrison 2016/11/16 17:01:05 Done (across the whole file).
158 setting = cookie_settings->GetCookieSetting(primary_url, secondary_url, 158 nullptr /* reading_setting */, &setting);
159 setting_cookie, NULL);
160 } else { 159 } else {
161 setting = map->GetContentSetting(primary_url, secondary_url, content_type, 160 setting = map->GetContentSetting(primary_url, secondary_url, content_type,
162 resource_identifier); 161 resource_identifier);
163 } 162 }
164 163
165 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 164 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
166 std::string setting_string = 165 std::string setting_string =
167 content_settings::ContentSettingToString(setting); 166 content_settings::ContentSettingToString(setting);
168 DCHECK(!setting_string.empty()); 167 DCHECK(!setting_string.empty());
169 result->SetString(keys::kContentSettingKey, setting_string); 168 result->SetString(keys::kContentSettingKey, setting_string);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 SetResult(std::move(list)); 309 SetResult(std::move(list));
311 BrowserThread::PostTask( 310 BrowserThread::PostTask(
312 BrowserThread::UI, FROM_HERE, base::Bind( 311 BrowserThread::UI, FROM_HERE, base::Bind(
313 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: 312 &ContentSettingsContentSettingGetResourceIdentifiersFunction::
314 SendResponse, 313 SendResponse,
315 this, 314 this,
316 true)); 315 true));
317 } 316 }
318 317
319 } // namespace extensions 318 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698