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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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 | 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/breakpad_mac.h" 8 #include "chrome/app/breakpad_mac.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 333 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
334 } 334 }
335 335
336 bool ChromeContentBrowserClient::AllowAppCache( 336 bool ChromeContentBrowserClient::AllowAppCache(
337 const GURL& manifest_url, 337 const GURL& manifest_url,
338 const content::ResourceContext& context) { 338 const content::ResourceContext& context) {
339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
340 ProfileIOData* io_data = 340 ProfileIOData* io_data =
341 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 341 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
342 // FIXME(jochen): get the correct top-level origin. 342 // FIXME(jochen): get the correct top-level origin.
343 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 343 return io_data->GetCookieContentSettings()->Allow(
344 GetCookieContentSetting(manifest_url, manifest_url, true); 344 manifest_url, manifest_url, true);
345 DCHECK(setting != CONTENT_SETTING_DEFAULT);
346 return setting != CONTENT_SETTING_BLOCK;
347 } 345 }
348 346
349 bool ChromeContentBrowserClient::AllowGetCookie( 347 bool ChromeContentBrowserClient::AllowGetCookie(
350 const GURL& url, 348 const GURL& url,
351 const GURL& first_party, 349 const GURL& first_party,
352 const net::CookieList& cookie_list, 350 const net::CookieList& cookie_list,
353 const content::ResourceContext& context, 351 const content::ResourceContext& context,
354 int render_process_id, 352 int render_process_id,
355 int render_view_id) { 353 int render_view_id) {
356 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
357 ProfileIOData* io_data = 355 ProfileIOData* io_data =
358 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 356 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
359 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 357 bool allow = io_data->GetCookieContentSettings()->Allow(
360 GetCookieContentSetting(url, first_party, false); 358 url, first_party, false);
361 bool allow = setting == CONTENT_SETTING_ALLOW ||
362 setting == CONTENT_SETTING_SESSION_ONLY;
363 359
364 BrowserThread::PostTask( 360 BrowserThread::PostTask(
365 BrowserThread::UI, FROM_HERE, 361 BrowserThread::UI, FROM_HERE,
366 NewRunnableFunction( 362 NewRunnableFunction(
367 &TabSpecificContentSettings::CookiesRead, 363 &TabSpecificContentSettings::CookiesRead,
368 render_process_id, render_view_id, url, cookie_list, !allow)); 364 render_process_id, render_view_id, url, cookie_list, !allow));
369 return allow; 365 return allow;
370 } 366 }
371 367
372 bool ChromeContentBrowserClient::AllowSetCookie( 368 bool ChromeContentBrowserClient::AllowSetCookie(
373 const GURL& url, 369 const GURL& url,
374 const GURL& first_party, 370 const GURL& first_party,
375 const std::string& cookie_line, 371 const std::string& cookie_line,
376 const content::ResourceContext& context, 372 const content::ResourceContext& context,
377 int render_process_id, 373 int render_process_id,
378 int render_view_id, 374 int render_view_id,
379 net::CookieOptions* options) { 375 net::CookieOptions* options) {
380 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
381 ProfileIOData* io_data = 377 ProfileIOData* io_data =
382 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 378 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
383 ContentSetting setting = io_data->GetHostContentSettingsMap()->
384 GetCookieContentSetting(url, first_party, true);
385 379
386 if (setting == CONTENT_SETTING_SESSION_ONLY) 380 bool allow = io_data->GetCookieContentSettings()->Allow(
381 url, first_party, true);
382
383 if (io_data->GetCookieContentSettings()->EnforceSessionOnly(url))
387 options->set_force_session(); 384 options->set_force_session();
388 385
389 bool allow = setting == CONTENT_SETTING_ALLOW ||
390 setting == CONTENT_SETTING_SESSION_ONLY;
391
392 BrowserThread::PostTask( 386 BrowserThread::PostTask(
393 BrowserThread::UI, FROM_HERE, 387 BrowserThread::UI, FROM_HERE,
394 NewRunnableFunction( 388 NewRunnableFunction(
395 &TabSpecificContentSettings::CookieChanged, 389 &TabSpecificContentSettings::CookieChanged,
396 render_process_id, render_view_id, url, cookie_line, *options, 390 render_process_id, render_view_id, url, cookie_line, *options,
397 !allow)); 391 !allow));
398 return allow; 392 return allow;
399 } 393 }
400 394
401 bool ChromeContentBrowserClient::AllowSaveLocalState( 395 bool ChromeContentBrowserClient::AllowSaveLocalState(
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 #if defined(USE_NSS) 724 #if defined(USE_NSS)
731 crypto::CryptoModuleBlockingPasswordDelegate* 725 crypto::CryptoModuleBlockingPasswordDelegate*
732 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 726 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
733 const GURL& url) { 727 const GURL& url) {
734 return browser::NewCryptoModuleBlockingDialogDelegate( 728 return browser::NewCryptoModuleBlockingDialogDelegate(
735 browser::kCryptoModulePasswordKeygen, url.host()); 729 browser::kCryptoModulePasswordKeygen, url.host());
736 } 730 }
737 #endif 731 #endif
738 732
739 } // namespace chrome 733 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698