| OLD | NEW |
| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 #endif | 540 #endif |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool ChromeContentBrowserClient::AllowAppCache( | 543 bool ChromeContentBrowserClient::AllowAppCache( |
| 544 const GURL& manifest_url, | 544 const GURL& manifest_url, |
| 545 const GURL& first_party, | 545 const GURL& first_party, |
| 546 const content::ResourceContext& context) { | 546 const content::ResourceContext& context) { |
| 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 548 ProfileIOData* io_data = | 548 ProfileIOData* io_data = |
| 549 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 549 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 550 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | 550 return io_data->GetCookieSettings()-> |
| 551 GetCookieContentSetting(manifest_url, first_party, true); | 551 IsSettingCookieAllowed(manifest_url, first_party); |
| 552 DCHECK(setting != CONTENT_SETTING_DEFAULT); | |
| 553 return setting != CONTENT_SETTING_BLOCK; | |
| 554 } | 552 } |
| 555 | 553 |
| 556 bool ChromeContentBrowserClient::AllowGetCookie( | 554 bool ChromeContentBrowserClient::AllowGetCookie( |
| 557 const GURL& url, | 555 const GURL& url, |
| 558 const GURL& first_party, | 556 const GURL& first_party, |
| 559 const net::CookieList& cookie_list, | 557 const net::CookieList& cookie_list, |
| 560 const content::ResourceContext& context, | 558 const content::ResourceContext& context, |
| 561 int render_process_id, | 559 int render_process_id, |
| 562 int render_view_id) { | 560 int render_view_id) { |
| 563 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 561 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 564 ProfileIOData* io_data = | 562 ProfileIOData* io_data = |
| 565 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 563 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 566 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | 564 bool allow = io_data->GetCookieSettings()-> |
| 567 GetCookieContentSetting(url, first_party, false); | 565 IsReadingCookieAllowed(url, first_party); |
| 568 bool allow = setting == CONTENT_SETTING_ALLOW || | |
| 569 setting == CONTENT_SETTING_SESSION_ONLY; | |
| 570 | 566 |
| 571 BrowserThread::PostTask( | 567 BrowserThread::PostTask( |
| 572 BrowserThread::UI, FROM_HERE, | 568 BrowserThread::UI, FROM_HERE, |
| 573 NewRunnableFunction( | 569 NewRunnableFunction( |
| 574 &TabSpecificContentSettings::CookiesRead, | 570 &TabSpecificContentSettings::CookiesRead, |
| 575 render_process_id, render_view_id, url, cookie_list, !allow)); | 571 render_process_id, render_view_id, url, cookie_list, !allow)); |
| 576 return allow; | 572 return allow; |
| 577 } | 573 } |
| 578 | 574 |
| 579 bool ChromeContentBrowserClient::AllowSetCookie( | 575 bool ChromeContentBrowserClient::AllowSetCookie( |
| 580 const GURL& url, | 576 const GURL& url, |
| 581 const GURL& first_party, | 577 const GURL& first_party, |
| 582 const std::string& cookie_line, | 578 const std::string& cookie_line, |
| 583 const content::ResourceContext& context, | 579 const content::ResourceContext& context, |
| 584 int render_process_id, | 580 int render_process_id, |
| 585 int render_view_id, | 581 int render_view_id, |
| 586 net::CookieOptions* options) { | 582 net::CookieOptions* options) { |
| 587 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 588 ProfileIOData* io_data = | 584 ProfileIOData* io_data = |
| 589 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 585 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 590 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | |
| 591 GetCookieContentSetting(url, first_party, true); | |
| 592 | 586 |
| 593 if (setting == CONTENT_SETTING_SESSION_ONLY) | 587 CookieSettings* cookie_settings = io_data->GetCookieSettings(); |
| 588 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party); |
| 589 |
| 590 if (cookie_settings->IsCookieSessionOnly(url)) |
| 594 options->set_force_session(); | 591 options->set_force_session(); |
| 595 | 592 |
| 596 bool allow = setting == CONTENT_SETTING_ALLOW || | |
| 597 setting == CONTENT_SETTING_SESSION_ONLY; | |
| 598 | |
| 599 BrowserThread::PostTask( | 593 BrowserThread::PostTask( |
| 600 BrowserThread::UI, FROM_HERE, | 594 BrowserThread::UI, FROM_HERE, |
| 601 NewRunnableFunction( | 595 NewRunnableFunction( |
| 602 &TabSpecificContentSettings::CookieChanged, | 596 &TabSpecificContentSettings::CookieChanged, |
| 603 render_process_id, render_view_id, url, cookie_line, *options, | 597 render_process_id, render_view_id, url, cookie_line, *options, |
| 604 !allow)); | 598 !allow)); |
| 605 return allow; | 599 return allow; |
| 606 } | 600 } |
| 607 | 601 |
| 608 bool ChromeContentBrowserClient::AllowSaveLocalState( | 602 bool ChromeContentBrowserClient::AllowSaveLocalState( |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 #if defined(USE_NSS) | 953 #if defined(USE_NSS) |
| 960 crypto::CryptoModuleBlockingPasswordDelegate* | 954 crypto::CryptoModuleBlockingPasswordDelegate* |
| 961 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 955 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 962 const GURL& url) { | 956 const GURL& url) { |
| 963 return browser::NewCryptoModuleBlockingDialogDelegate( | 957 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 964 browser::kCryptoModulePasswordKeygen, url.host()); | 958 browser::kCryptoModulePasswordKeygen, url.host()); |
| 965 } | 959 } |
| 966 #endif | 960 #endif |
| 967 | 961 |
| 968 } // namespace chrome | 962 } // namespace chrome |
| OLD | NEW |