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

Side by Side Diff: chrome/browser/net/chrome_cookie_policy.cc

Issue 2878075: Introduce a resource identifier for content settings. (Closed)
Patch Set: updates Created 10 years, 4 months 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/net/chrome_cookie_policy.h" 5 #include "chrome/browser/net/chrome_cookie_policy.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" 10 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 completions.push_back(Completion::ForSetCookie(callback)); 132 completions.push_back(Completion::ForSetCookie(callback));
133 policy = net::ERR_IO_PENDING; 133 policy = net::ERR_IO_PENDING;
134 } 134 }
135 135
136 PromptForSetCookie(url, cookie_line); 136 PromptForSetCookie(url, cookie_line);
137 return policy; 137 return policy;
138 } 138 }
139 139
140 int ChromeCookiePolicy::CheckPolicy(const GURL& url) const { 140 int ChromeCookiePolicy::CheckPolicy(const GURL& url) const {
141 ContentSetting setting = host_content_settings_map_->GetContentSetting( 141 ContentSetting setting = host_content_settings_map_->GetContentSetting(
142 url, CONTENT_SETTINGS_TYPE_COOKIES); 142 url, CONTENT_SETTINGS_TYPE_COOKIES, "");
143 if (setting == CONTENT_SETTING_BLOCK) 143 if (setting == CONTENT_SETTING_BLOCK)
144 return net::ERR_ACCESS_DENIED; 144 return net::ERR_ACCESS_DENIED;
145 if (setting == CONTENT_SETTING_ALLOW) 145 if (setting == CONTENT_SETTING_ALLOW)
146 return net::OK; 146 return net::OK;
147 if (setting == CONTENT_SETTING_SESSION_ONLY) 147 if (setting == CONTENT_SETTING_SESSION_ONLY)
148 return net::OK_FOR_SESSION_ONLY; 148 return net::OK_FOR_SESSION_ONLY;
149 return net::ERR_IO_PENDING; // Need to prompt. 149 return net::ERR_IO_PENDING; // Need to prompt.
150 } 150 }
151 151
152 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url, 152 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 callbacks.push_back(completions[i].callback()); 214 callbacks.push_back(completions[i].callback());
215 } 215 }
216 completions.erase(completions.begin(), completions.begin() + i); 216 completions.erase(completions.begin(), completions.begin() + i);
217 217
218 if (completions.empty()) 218 if (completions.empty())
219 host_completions_map_.erase(it); 219 host_completions_map_.erase(it);
220 220
221 for (size_t j = 0; j < callbacks.size(); ++j) 221 for (size_t j = 0; j < callbacks.size(); ++j)
222 callbacks[j]->Run(policy); 222 callbacks[j]->Run(policy);
223 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698