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

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: Keeping up to date with trunk. Created 9 years, 3 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"
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/geolocation/chrome_access_token_store.h" 24 #include "chrome/browser/geolocation/chrome_access_token_store.h"
24 #include "chrome/browser/google/google_util.h" 25 #include "chrome/browser/google/google_util.h"
25 #include "chrome/browser/net/chrome_net_log.h" 26 #include "chrome/browser/net/chrome_net_log.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 384 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
384 } 385 }
385 386
386 bool ChromeContentBrowserClient::AllowAppCache( 387 bool ChromeContentBrowserClient::AllowAppCache(
387 const GURL& manifest_url, 388 const GURL& manifest_url,
388 const content::ResourceContext& context) { 389 const content::ResourceContext& context) {
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
390 ProfileIOData* io_data = 391 ProfileIOData* io_data =
391 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 392 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
392 // FIXME(jochen): get the correct top-level origin. 393 // FIXME(jochen): get the correct top-level origin.
393 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 394 return io_data->GetCookieSettings()->
394 GetCookieContentSetting(manifest_url, manifest_url, true); 395 IsSettingCookieAllowed(manifest_url, manifest_url);
395 DCHECK(setting != CONTENT_SETTING_DEFAULT);
396 return setting != CONTENT_SETTING_BLOCK;
397 } 396 }
398 397
399 bool ChromeContentBrowserClient::AllowGetCookie( 398 bool ChromeContentBrowserClient::AllowGetCookie(
400 const GURL& url, 399 const GURL& url,
401 const GURL& first_party, 400 const GURL& first_party,
402 const net::CookieList& cookie_list, 401 const net::CookieList& cookie_list,
403 const content::ResourceContext& context, 402 const content::ResourceContext& context,
404 int render_process_id, 403 int render_process_id,
405 int render_view_id) { 404 int render_view_id) {
406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
407 ProfileIOData* io_data = 406 ProfileIOData* io_data =
408 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 407 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
409 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 408 bool allow = io_data->GetCookieSettings()->
410 GetCookieContentSetting(url, first_party, false); 409 IsReadingCookieAllowed(url, first_party);
411 bool allow = setting == CONTENT_SETTING_ALLOW ||
412 setting == CONTENT_SETTING_SESSION_ONLY;
413 410
414 BrowserThread::PostTask( 411 BrowserThread::PostTask(
415 BrowserThread::UI, FROM_HERE, 412 BrowserThread::UI, FROM_HERE,
416 NewRunnableFunction( 413 NewRunnableFunction(
417 &TabSpecificContentSettings::CookiesRead, 414 &TabSpecificContentSettings::CookiesRead,
418 render_process_id, render_view_id, url, cookie_list, !allow)); 415 render_process_id, render_view_id, url, cookie_list, !allow));
419 return allow; 416 return allow;
420 } 417 }
421 418
422 bool ChromeContentBrowserClient::AllowSetCookie( 419 bool ChromeContentBrowserClient::AllowSetCookie(
423 const GURL& url, 420 const GURL& url,
424 const GURL& first_party, 421 const GURL& first_party,
425 const std::string& cookie_line, 422 const std::string& cookie_line,
426 const content::ResourceContext& context, 423 const content::ResourceContext& context,
427 int render_process_id, 424 int render_process_id,
428 int render_view_id, 425 int render_view_id,
429 net::CookieOptions* options) { 426 net::CookieOptions* options) {
430 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 427 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
431 ProfileIOData* io_data = 428 ProfileIOData* io_data =
432 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 429 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
433 ContentSetting setting = io_data->GetHostContentSettingsMap()->
434 GetCookieContentSetting(url, first_party, true);
435 430
436 if (setting == CONTENT_SETTING_SESSION_ONLY) 431 CookieSettings* cookie_settings = io_data->GetCookieSettings();
432 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party);
433
434 if (cookie_settings->IsCookieSessionOnly(url))
437 options->set_force_session(); 435 options->set_force_session();
438 436
439 bool allow = setting == CONTENT_SETTING_ALLOW ||
440 setting == CONTENT_SETTING_SESSION_ONLY;
441
442 BrowserThread::PostTask( 437 BrowserThread::PostTask(
443 BrowserThread::UI, FROM_HERE, 438 BrowserThread::UI, FROM_HERE,
444 NewRunnableFunction( 439 NewRunnableFunction(
445 &TabSpecificContentSettings::CookieChanged, 440 &TabSpecificContentSettings::CookieChanged,
446 render_process_id, render_view_id, url, cookie_line, *options, 441 render_process_id, render_view_id, url, cookie_line, *options,
447 !allow)); 442 !allow));
448 return allow; 443 return allow;
449 } 444 }
450 445
451 bool ChromeContentBrowserClient::AllowSaveLocalState( 446 bool ChromeContentBrowserClient::AllowSaveLocalState(
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 #if defined(USE_NSS) 801 #if defined(USE_NSS)
807 crypto::CryptoModuleBlockingPasswordDelegate* 802 crypto::CryptoModuleBlockingPasswordDelegate*
808 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 803 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
809 const GURL& url) { 804 const GURL& url) {
810 return browser::NewCryptoModuleBlockingDialogDelegate( 805 return browser::NewCryptoModuleBlockingDialogDelegate(
811 browser::kCryptoModulePasswordKeygen, url.host()); 806 browser::kCryptoModulePasswordKeygen, url.host());
812 } 807 }
813 #endif 808 #endif
814 809
815 } // namespace chrome 810 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698