| 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_plugin_message_filter.h" | 13 #include "chrome/browser/chrome_plugin_message_filter.h" |
| 14 #include "chrome/browser/chrome_quota_permission_context.h" | 14 #include "chrome/browser/chrome_quota_permission_context.h" |
| 15 #include "chrome/browser/chrome_worker_message_filter.h" | 15 #include "chrome/browser/chrome_worker_message_filter.h" |
| 16 #include "chrome/browser/content_settings/cookie_settings.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 18 #include "chrome/browser/download/download_util.h" | 19 #include "chrome/browser/download/download_util.h" |
| 19 #include "chrome/browser/extensions/extension_info_map.h" | 20 #include "chrome/browser/extensions/extension_info_map.h" |
| 20 #include "chrome/browser/extensions/extension_message_handler.h" | 21 #include "chrome/browser/extensions/extension_message_handler.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/extension_web_ui.h" | 23 #include "chrome/browser/extensions/extension_web_ui.h" |
| 23 #include "chrome/browser/google/google_util.h" | 24 #include "chrome/browser/google/google_util.h" |
| 24 #include "chrome/browser/net/chrome_net_log.h" | 25 #include "chrome/browser/net/chrome_net_log.h" |
| 25 #include "chrome/browser/notifications/desktop_notification_service.h" | 26 #include "chrome/browser/notifications/desktop_notification_service.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 334 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
| 334 } | 335 } |
| 335 | 336 |
| 336 bool ChromeContentBrowserClient::AllowAppCache( | 337 bool ChromeContentBrowserClient::AllowAppCache( |
| 337 const GURL& manifest_url, | 338 const GURL& manifest_url, |
| 338 const content::ResourceContext& context) { | 339 const content::ResourceContext& context) { |
| 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 340 ProfileIOData* io_data = | 341 ProfileIOData* io_data = |
| 341 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 342 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 342 // FIXME(jochen): get the correct top-level origin. | 343 // FIXME(jochen): get the correct top-level origin. |
| 343 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | 344 return io_data->GetHostContentSettingsMap()->GetCookieSettings()-> |
| 344 GetCookieContentSetting(manifest_url, manifest_url, true); | 345 IsCookieAllowed(manifest_url, manifest_url, true); |
| 345 DCHECK(setting != CONTENT_SETTING_DEFAULT); | |
| 346 return setting != CONTENT_SETTING_BLOCK; | |
| 347 } | 346 } |
| 348 | 347 |
| 349 bool ChromeContentBrowserClient::AllowGetCookie( | 348 bool ChromeContentBrowserClient::AllowGetCookie( |
| 350 const GURL& url, | 349 const GURL& url, |
| 351 const GURL& first_party, | 350 const GURL& first_party, |
| 352 const net::CookieList& cookie_list, | 351 const net::CookieList& cookie_list, |
| 353 const content::ResourceContext& context, | 352 const content::ResourceContext& context, |
| 354 int render_process_id, | 353 int render_process_id, |
| 355 int render_view_id) { | 354 int render_view_id) { |
| 356 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 355 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 357 ProfileIOData* io_data = | 356 ProfileIOData* io_data = |
| 358 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 357 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 359 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | 358 bool allow = io_data->GetHostContentSettingsMap()->GetCookieSettings()-> |
| 360 GetCookieContentSetting(url, first_party, false); | 359 IsCookieAllowed(url, first_party, false); |
| 361 bool allow = setting == CONTENT_SETTING_ALLOW || | |
| 362 setting == CONTENT_SETTING_SESSION_ONLY; | |
| 363 | 360 |
| 364 BrowserThread::PostTask( | 361 BrowserThread::PostTask( |
| 365 BrowserThread::UI, FROM_HERE, | 362 BrowserThread::UI, FROM_HERE, |
| 366 NewRunnableFunction( | 363 NewRunnableFunction( |
| 367 &TabSpecificContentSettings::CookiesRead, | 364 &TabSpecificContentSettings::CookiesRead, |
| 368 render_process_id, render_view_id, url, cookie_list, !allow)); | 365 render_process_id, render_view_id, url, cookie_list, !allow)); |
| 369 return allow; | 366 return allow; |
| 370 } | 367 } |
| 371 | 368 |
| 372 bool ChromeContentBrowserClient::AllowSetCookie( | 369 bool ChromeContentBrowserClient::AllowSetCookie( |
| 373 const GURL& url, | 370 const GURL& url, |
| 374 const GURL& first_party, | 371 const GURL& first_party, |
| 375 const std::string& cookie_line, | 372 const std::string& cookie_line, |
| 376 const content::ResourceContext& context, | 373 const content::ResourceContext& context, |
| 377 int render_process_id, | 374 int render_process_id, |
| 378 int render_view_id, | 375 int render_view_id, |
| 379 net::CookieOptions* options) { | 376 net::CookieOptions* options) { |
| 380 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 381 ProfileIOData* io_data = | 378 ProfileIOData* io_data = |
| 382 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 379 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 383 ContentSetting setting = io_data->GetHostContentSettingsMap()-> | |
| 384 GetCookieContentSetting(url, first_party, true); | |
| 385 | 380 |
| 386 if (setting == CONTENT_SETTING_SESSION_ONLY) | 381 CookieSettings* cookie_settings = |
| 382 io_data->GetHostContentSettingsMap()->GetCookieSettings(); |
| 383 bool allow = cookie_settings->IsCookieAllowed(url, first_party, true); |
| 384 |
| 385 if (cookie_settings->IsCookieSessionOnly(url)) |
| 387 options->set_force_session(); | 386 options->set_force_session(); |
| 388 | 387 |
| 389 bool allow = setting == CONTENT_SETTING_ALLOW || | |
| 390 setting == CONTENT_SETTING_SESSION_ONLY; | |
| 391 | |
| 392 BrowserThread::PostTask( | 388 BrowserThread::PostTask( |
| 393 BrowserThread::UI, FROM_HERE, | 389 BrowserThread::UI, FROM_HERE, |
| 394 NewRunnableFunction( | 390 NewRunnableFunction( |
| 395 &TabSpecificContentSettings::CookieChanged, | 391 &TabSpecificContentSettings::CookieChanged, |
| 396 render_process_id, render_view_id, url, cookie_line, *options, | 392 render_process_id, render_view_id, url, cookie_line, *options, |
| 397 !allow)); | 393 !allow)); |
| 398 return allow; | 394 return allow; |
| 399 } | 395 } |
| 400 | 396 |
| 401 bool ChromeContentBrowserClient::AllowSaveLocalState( | 397 bool ChromeContentBrowserClient::AllowSaveLocalState( |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #if defined(USE_NSS) | 726 #if defined(USE_NSS) |
| 731 crypto::CryptoModuleBlockingPasswordDelegate* | 727 crypto::CryptoModuleBlockingPasswordDelegate* |
| 732 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 728 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 733 const GURL& url) { | 729 const GURL& url) { |
| 734 return browser::NewCryptoModuleBlockingDialogDelegate( | 730 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 735 browser::kCryptoModulePasswordKeygen, url.host()); | 731 browser::kCryptoModulePasswordKeygen, url.host()); |
| 736 } | 732 } |
| 737 #endif | 733 #endif |
| 738 | 734 |
| 739 } // namespace chrome | 735 } // namespace chrome |
| OLD | NEW |