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

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: Tiny fixes (unnecessary #includes, win + mac fixes). 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 361 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
361 } 362 }
362 363
363 bool ChromeContentBrowserClient::AllowAppCache( 364 bool ChromeContentBrowserClient::AllowAppCache(
364 const GURL& manifest_url, 365 const GURL& manifest_url,
365 const content::ResourceContext& context) { 366 const content::ResourceContext& context) {
366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
367 ProfileIOData* io_data = 368 ProfileIOData* io_data =
368 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 369 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
369 // FIXME(jochen): get the correct top-level origin. 370 // FIXME(jochen): get the correct top-level origin.
370 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 371 return io_data->GetCookieSettings()->
371 GetCookieContentSetting(manifest_url, manifest_url, true); 372 IsSettingCookieAllowed(manifest_url, manifest_url);
372 DCHECK(setting != CONTENT_SETTING_DEFAULT);
373 return setting != CONTENT_SETTING_BLOCK;
374 } 373 }
375 374
376 bool ChromeContentBrowserClient::AllowGetCookie( 375 bool ChromeContentBrowserClient::AllowGetCookie(
377 const GURL& url, 376 const GURL& url,
378 const GURL& first_party, 377 const GURL& first_party,
379 const net::CookieList& cookie_list, 378 const net::CookieList& cookie_list,
380 const content::ResourceContext& context, 379 const content::ResourceContext& context,
381 int render_process_id, 380 int render_process_id,
382 int render_view_id) { 381 int render_view_id) {
383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
384 ProfileIOData* io_data = 383 ProfileIOData* io_data =
385 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 384 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
386 ContentSetting setting = io_data->GetHostContentSettingsMap()-> 385 bool allow = io_data->GetCookieSettings()->
387 GetCookieContentSetting(url, first_party, false); 386 IsReadingCookieAllowed(url, first_party);
388 bool allow = setting == CONTENT_SETTING_ALLOW ||
389 setting == CONTENT_SETTING_SESSION_ONLY;
390 387
391 BrowserThread::PostTask( 388 BrowserThread::PostTask(
392 BrowserThread::UI, FROM_HERE, 389 BrowserThread::UI, FROM_HERE,
393 NewRunnableFunction( 390 NewRunnableFunction(
394 &TabSpecificContentSettings::CookiesRead, 391 &TabSpecificContentSettings::CookiesRead,
395 render_process_id, render_view_id, url, cookie_list, !allow)); 392 render_process_id, render_view_id, url, cookie_list, !allow));
396 return allow; 393 return allow;
397 } 394 }
398 395
399 bool ChromeContentBrowserClient::AllowSetCookie( 396 bool ChromeContentBrowserClient::AllowSetCookie(
400 const GURL& url, 397 const GURL& url,
401 const GURL& first_party, 398 const GURL& first_party,
402 const std::string& cookie_line, 399 const std::string& cookie_line,
403 const content::ResourceContext& context, 400 const content::ResourceContext& context,
404 int render_process_id, 401 int render_process_id,
405 int render_view_id, 402 int render_view_id,
406 net::CookieOptions* options) { 403 net::CookieOptions* options) {
407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
408 ProfileIOData* io_data = 405 ProfileIOData* io_data =
409 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 406 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
410 ContentSetting setting = io_data->GetHostContentSettingsMap()->
411 GetCookieContentSetting(url, first_party, true);
412 407
413 if (setting == CONTENT_SETTING_SESSION_ONLY) 408 CookieSettings* cookie_settings = io_data->GetCookieSettings();
409 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party);
410
411 if (cookie_settings->IsCookieSessionOnly(url))
414 options->set_force_session(); 412 options->set_force_session();
415 413
416 bool allow = setting == CONTENT_SETTING_ALLOW ||
417 setting == CONTENT_SETTING_SESSION_ONLY;
418
419 BrowserThread::PostTask( 414 BrowserThread::PostTask(
420 BrowserThread::UI, FROM_HERE, 415 BrowserThread::UI, FROM_HERE,
421 NewRunnableFunction( 416 NewRunnableFunction(
422 &TabSpecificContentSettings::CookieChanged, 417 &TabSpecificContentSettings::CookieChanged,
423 render_process_id, render_view_id, url, cookie_line, *options, 418 render_process_id, render_view_id, url, cookie_line, *options,
424 !allow)); 419 !allow));
425 return allow; 420 return allow;
426 } 421 }
427 422
428 bool ChromeContentBrowserClient::AllowSaveLocalState( 423 bool ChromeContentBrowserClient::AllowSaveLocalState(
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 #if defined(USE_NSS) 778 #if defined(USE_NSS)
784 crypto::CryptoModuleBlockingPasswordDelegate* 779 crypto::CryptoModuleBlockingPasswordDelegate*
785 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 780 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
786 const GURL& url) { 781 const GURL& url) {
787 return browser::NewCryptoModuleBlockingDialogDelegate( 782 return browser::NewCryptoModuleBlockingDialogDelegate(
788 browser::kCryptoModulePasswordKeygen, url.host()); 783 browser::kCryptoModulePasswordKeygen, url.host());
789 } 784 }
790 #endif 785 #endif
791 786
792 } // namespace chrome 787 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_worker_message_filter.h » ('j') | chrome/browser/content_settings/cookie_settings.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698