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

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

Issue 2858018: Add a "session only" policy to the content settings. (Closed)
Patch Set: Created 10 years, 6 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
148 return net::OK_FOR_SESSION_ONLY;
147 return net::ERR_IO_PENDING; // Need to prompt. 149 return net::ERR_IO_PENDING; // Need to prompt.
148 } 150 }
149 151
150 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url, 152 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url,
151 const std::string& cookie_line) { 153 const std::string& cookie_line) {
152 if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { 154 if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) {
153 ChromeThread::PostTask( 155 ChromeThread::PostTask(
154 ChromeThread::UI, FROM_HERE, 156 ChromeThread::UI, FROM_HERE,
155 NewRunnableMethod(this, &ChromeCookiePolicy::PromptForSetCookie, url, 157 NewRunnableMethod(this, &ChromeCookiePolicy::PromptForSetCookie, url,
156 cookie_line)); 158 cookie_line));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 callbacks.push_back(completions[i].callback()); 214 callbacks.push_back(completions[i].callback());
213 } 215 }
214 completions.erase(completions.begin(), completions.begin() + i); 216 completions.erase(completions.begin(), completions.begin() + i);
215 217
216 if (completions.empty()) 218 if (completions.empty())
217 host_completions_map_.erase(it); 219 host_completions_map_.erase(it);
218 220
219 for (size_t j = 0; j < callbacks.size(); ++j) 221 for (size_t j = 0; j < callbacks.size(); ++j)
220 callbacks[j]->Run(policy); 222 callbacks[j]->Run(policy);
221 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/in_process_webkit/dom_storage_area.cc ('k') | chrome/browser/renderer_host/database_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698