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

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

Issue 8383004: Adding CookieSettings for storing cookie content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing the rebase. 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
« no previous file with comments | « no previous file | chrome/browser/chrome_worker_message_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "chrome/browser/browsing_data_remover.h" 11 #include "chrome/browser/browsing_data_remover.h"
12 #include "chrome/browser/character_encoding.h" 12 #include "chrome/browser/character_encoding.h"
13 #include "chrome/browser/chrome_benchmarking_message_filter.h" 13 #include "chrome/browser/chrome_benchmarking_message_filter.h"
14 #include "chrome/browser/chrome_plugin_message_filter.h" 14 #include "chrome/browser/chrome_plugin_message_filter.h"
15 #include "chrome/browser/chrome_quota_permission_context.h" 15 #include "chrome/browser/chrome_quota_permission_context.h"
16 #include "chrome/browser/chrome_worker_message_filter.h" 16 #include "chrome/browser/chrome_worker_message_filter.h"
17 #include "chrome/browser/content_settings/host_content_settings_map.h" 17 #include "chrome/browser/content_settings/cookie_settings.h"
18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 18 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
19 #include "chrome/browser/download/download_util.h" 19 #include "chrome/browser/download/download_util.h"
20 #include "chrome/browser/extensions/extension_info_map.h" 20 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/browser/extensions/extension_message_handler.h" 21 #include "chrome/browser/extensions/extension_message_handler.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/extension_web_ui.h" 23 #include "chrome/browser/extensions/extension_web_ui.h"
24 #include "chrome/browser/extensions/extension_webrequest_api.h" 24 #include "chrome/browser/extensions/extension_webrequest_api.h"
25 #include "chrome/browser/geolocation/chrome_access_token_store.h" 25 #include "chrome/browser/geolocation/chrome_access_token_store.h"
26 #include "chrome/browser/google/google_util.h" 26 #include "chrome/browser/google/google_util.h"
27 #include "chrome/browser/net/chrome_net_log.h" 27 #include "chrome/browser/net/chrome_net_log.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 #endif 577 #endif
578 } 578 }
579 579
580 bool ChromeContentBrowserClient::AllowAppCache( 580 bool ChromeContentBrowserClient::AllowAppCache(
581 const GURL& manifest_url, 581 const GURL& manifest_url,
582 const GURL& first_party, 582 const GURL& first_party,
583 const content::ResourceContext& context) { 583 const content::ResourceContext& context) {
584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
585 ProfileIOData* io_data = 585 ProfileIOData* io_data =
586 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 586 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
587 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 587 return io_data->GetCookieSettings()->
588 GetCookieContentSetting(manifest_url, first_party, true); 588 IsSettingCookieAllowed(manifest_url, first_party);
589 DCHECK(setting != CONTENT_SETTING_DEFAULT);
590 return setting != CONTENT_SETTING_BLOCK;
591 } 589 }
592 590
593 bool ChromeContentBrowserClient::AllowGetCookie( 591 bool ChromeContentBrowserClient::AllowGetCookie(
594 const GURL& url, 592 const GURL& url,
595 const GURL& first_party, 593 const GURL& first_party,
596 const net::CookieList& cookie_list, 594 const net::CookieList& cookie_list,
597 const content::ResourceContext& context, 595 const content::ResourceContext& context,
598 int render_process_id, 596 int render_process_id,
599 int render_view_id) { 597 int render_view_id) {
600 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 598 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
601 ProfileIOData* io_data = 599 ProfileIOData* io_data =
602 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 600 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
603 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 601 bool allow = io_data->GetCookieSettings()->
604 GetCookieContentSetting(url, first_party, false); 602 IsReadingCookieAllowed(url, first_party);
605 bool allow = setting == CONTENT_SETTING_ALLOW ||
606 setting == CONTENT_SETTING_SESSION_ONLY;
607 603
608 BrowserThread::PostTask( 604 BrowserThread::PostTask(
609 BrowserThread::UI, FROM_HERE, 605 BrowserThread::UI, FROM_HERE,
610 NewRunnableFunction( 606 NewRunnableFunction(
611 &TabSpecificContentSettings::CookiesRead, 607 &TabSpecificContentSettings::CookiesRead,
612 render_process_id, render_view_id, url, cookie_list, !allow)); 608 render_process_id, render_view_id, url, cookie_list, !allow));
613 return allow; 609 return allow;
614 } 610 }
615 611
616 bool ChromeContentBrowserClient::AllowSetCookie( 612 bool ChromeContentBrowserClient::AllowSetCookie(
617 const GURL& url, 613 const GURL& url,
618 const GURL& first_party, 614 const GURL& first_party,
619 const std::string& cookie_line, 615 const std::string& cookie_line,
620 const content::ResourceContext& context, 616 const content::ResourceContext& context,
621 int render_process_id, 617 int render_process_id,
622 int render_view_id, 618 int render_view_id,
623 net::CookieOptions* options) { 619 net::CookieOptions* options) {
624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
625 ProfileIOData* io_data = 621 ProfileIOData* io_data =
626 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 622 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
627 ContentSetting setting = io_data->GetHostContentSettingsMap()->
628 GetCookieContentSetting(url, first_party, true);
629 623
630 if (setting == CONTENT_SETTING_SESSION_ONLY) 624 CookieSettings* cookie_settings = io_data->GetCookieSettings();
625 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party);
626
627 if (cookie_settings->IsCookieSessionOnly(url))
631 options->set_force_session(); 628 options->set_force_session();
632 629
633 bool allow = setting == CONTENT_SETTING_ALLOW ||
634 setting == CONTENT_SETTING_SESSION_ONLY;
635
636 BrowserThread::PostTask( 630 BrowserThread::PostTask(
637 BrowserThread::UI, FROM_HERE, 631 BrowserThread::UI, FROM_HERE,
638 NewRunnableFunction( 632 NewRunnableFunction(
639 &TabSpecificContentSettings::CookieChanged, 633 &TabSpecificContentSettings::CookieChanged,
640 render_process_id, render_view_id, url, cookie_line, *options, 634 render_process_id, render_view_id, url, cookie_line, *options,
641 !allow)); 635 !allow));
642 return allow; 636 return allow;
643 } 637 }
644 638
645 bool ChromeContentBrowserClient::AllowSaveLocalState( 639 bool ChromeContentBrowserClient::AllowSaveLocalState(
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 #if defined(USE_NSS) 990 #if defined(USE_NSS)
997 crypto::CryptoModuleBlockingPasswordDelegate* 991 crypto::CryptoModuleBlockingPasswordDelegate*
998 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 992 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
999 const GURL& url) { 993 const GURL& url) {
1000 return browser::NewCryptoModuleBlockingDialogDelegate( 994 return browser::NewCryptoModuleBlockingDialogDelegate(
1001 browser::kCryptoModulePasswordKeygen, url.host()); 995 browser::kCryptoModulePasswordKeygen, url.host());
1002 } 996 }
1003 #endif 997 #endif
1004 998
1005 } // namespace chrome 999 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_worker_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698