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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 7831075: Delegating the "are images allowed" decision to renderer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More code review comments. 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/content_settings/tab_specific_content_settings.h" 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 } 413 }
414 414
415 void TabSpecificContentSettings::RenderViewCreated( 415 void TabSpecificContentSettings::RenderViewCreated(
416 RenderViewHost* render_view_host) { 416 RenderViewHost* render_view_host) {
417 Profile* profile = 417 Profile* profile =
418 Profile::FromBrowserContext(tab_contents()->browser_context()); 418 Profile::FromBrowserContext(tab_contents()->browser_context());
419 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 419 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
420 render_view_host->Send(new ChromeViewMsg_SetDefaultContentSettings( 420 render_view_host->Send(new ChromeViewMsg_SetDefaultContentSettings(
421 map->GetDefaultContentSettings())); 421 map->GetDefaultContentSettings()));
422
423 ContentSettingsForOneType settings;
424 map->GetSettingsForOneType(
425 CONTENT_SETTINGS_TYPE_IMAGES, "",
426 &content_settings::ProviderInterface::Rule::PatternPrecedenceSort,
427 &settings);
428 settings.push_back(ContentSettingPatternSourceTuple(
429 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
430 map->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_IMAGES), ""));
431 render_view_host->Send(new ChromeViewMsg_SetImageSettingRules(settings));
422 } 432 }
423 433
424 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( 434 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame(
425 int64 frame_id, 435 int64 frame_id,
426 bool is_main_frame, 436 bool is_main_frame,
427 const GURL& validated_url, 437 const GURL& validated_url,
428 bool is_error_page, 438 bool is_error_page,
429 RenderViewHost* render_view_host) { 439 RenderViewHost* render_view_host) {
430 if (!is_main_frame) 440 if (!is_main_frame)
431 return; 441 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // The active NavigationEntry is the URL in the URL field of a tab. 474 // The active NavigationEntry is the URL in the URL field of a tab.
465 // Currently this should be matched by the |primary_pattern|. 475 // Currently this should be matched by the |primary_pattern|.
466 settings_details.ptr()->primary_pattern().Matches(entry_url)) { 476 settings_details.ptr()->primary_pattern().Matches(entry_url)) {
467 Profile* profile = 477 Profile* profile =
468 Profile::FromBrowserContext(tab_contents()->browser_context()); 478 Profile::FromBrowserContext(tab_contents()->browser_context());
469 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 479 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
470 Send(new ChromeViewMsg_SetDefaultContentSettings( 480 Send(new ChromeViewMsg_SetDefaultContentSettings(
471 map->GetDefaultContentSettings())); 481 map->GetDefaultContentSettings()));
472 Send(new ChromeViewMsg_SetContentSettingsForCurrentURL( 482 Send(new ChromeViewMsg_SetContentSettingsForCurrentURL(
473 entry_url, map->GetContentSettings(entry_url, entry_url))); 483 entry_url, map->GetContentSettings(entry_url, entry_url)));
484 ContentSettingsForOneType settings;
485 map->GetSettingsForOneType(
486 CONTENT_SETTINGS_TYPE_IMAGES, "",
487 &content_settings::ProviderInterface::Rule::PatternPrecedenceSort,
488 &settings);
489 settings.push_back(ContentSettingPatternSourceTuple(
490 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
491 map->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_IMAGES), ""));
492 Send(new ChromeViewMsg_SetImageSettingRules(settings));
474 } 493 }
475 } 494 }
476 495
477 TabSpecificContentSettings::LocalSharedObjectsContainer:: 496 TabSpecificContentSettings::LocalSharedObjectsContainer::
478 LocalSharedObjectsContainer(Profile* profile) 497 LocalSharedObjectsContainer(Profile* profile)
479 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), 498 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)),
480 cookies_(new CannedBrowsingDataCookieHelper(profile)), 499 cookies_(new CannedBrowsingDataCookieHelper(profile)),
481 databases_(new CannedBrowsingDataDatabaseHelper(profile)), 500 databases_(new CannedBrowsingDataDatabaseHelper(profile)),
482 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), 501 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)),
483 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper()), 502 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper()),
(...skipping 20 matching lines...) Expand all
504 return new CookiesTreeModel(cookies_->Clone(), 523 return new CookiesTreeModel(cookies_->Clone(),
505 databases_->Clone(), 524 databases_->Clone(),
506 local_storages_->Clone(), 525 local_storages_->Clone(),
507 session_storages_->Clone(), 526 session_storages_->Clone(),
508 appcaches_->Clone(), 527 appcaches_->Clone(),
509 indexed_dbs_->Clone(), 528 indexed_dbs_->Clone(),
510 file_systems_->Clone(), 529 file_systems_->Clone(),
511 NULL, 530 NULL,
512 true); 531 true);
513 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698