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/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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 void TabSpecificContentSettings::DidNavigateMainFramePostCommit( | 424 void TabSpecificContentSettings::DidNavigateMainFramePostCommit( |
425 const content::LoadCommittedDetails& details, | 425 const content::LoadCommittedDetails& details, |
426 const ViewHostMsg_FrameNavigate_Params& params) { | 426 const ViewHostMsg_FrameNavigate_Params& params) { |
427 if (!details.is_in_page) { | 427 if (!details.is_in_page) { |
428 // Clear "blocked" flags. | 428 // Clear "blocked" flags. |
429 ClearBlockedContentSettingsExceptForCookies(); | 429 ClearBlockedContentSettingsExceptForCookies(); |
430 GeolocationDidNavigate(details); | 430 GeolocationDidNavigate(details); |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
434 void TabSpecificContentSettings::RenderViewCreated( | |
435 RenderViewHost* render_view_host) { | |
436 Profile* profile = | |
437 Profile::FromBrowserContext(tab_contents()->browser_context()); | |
438 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | |
439 render_view_host->Send(new ChromeViewMsg_SetDefaultContentSettings( | |
440 map->GetDefaultContentSettings())); | |
441 } | |
442 | |
443 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( | 434 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( |
444 int64 frame_id, | 435 int64 frame_id, |
445 bool is_main_frame, | 436 bool is_main_frame, |
446 const GURL& validated_url, | 437 const GURL& validated_url, |
447 bool is_error_page, | 438 bool is_error_page, |
448 RenderViewHost* render_view_host) { | 439 RenderViewHost* render_view_host) { |
449 if (!is_main_frame) | 440 if (!is_main_frame) |
450 return; | 441 return; |
451 | 442 |
452 // If we're displaying a network error page do not reset the content | 443 // If we're displaying a network error page do not reset the content |
(...skipping 26 matching lines...) Expand all Loading... |
479 NavigationEntry* entry = controller.GetActiveEntry(); | 470 NavigationEntry* entry = controller.GetActiveEntry(); |
480 GURL entry_url; | 471 GURL entry_url; |
481 if (entry) | 472 if (entry) |
482 entry_url = entry->url(); | 473 entry_url = entry->url(); |
483 if (settings_details.ptr()->update_all() || | 474 if (settings_details.ptr()->update_all() || |
484 // The active NavigationEntry is the URL in the URL field of a tab. | 475 // The active NavigationEntry is the URL in the URL field of a tab. |
485 // Currently this should be matched by the |primary_pattern|. | 476 // Currently this should be matched by the |primary_pattern|. |
486 settings_details.ptr()->primary_pattern().Matches(entry_url)) { | 477 settings_details.ptr()->primary_pattern().Matches(entry_url)) { |
487 Profile* profile = | 478 Profile* profile = |
488 Profile::FromBrowserContext(tab_contents()->browser_context()); | 479 Profile::FromBrowserContext(tab_contents()->browser_context()); |
489 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | |
490 Send(new ChromeViewMsg_SetDefaultContentSettings( | |
491 map->GetDefaultContentSettings())); | |
492 Send(new ChromeViewMsg_SetContentSettingsForCurrentURL( | |
493 entry_url, map->GetContentSettings(entry_url))); | |
494 RendererContentSettingRules rules; | 480 RendererContentSettingRules rules; |
495 GetRendererContentSettingRules(map, &rules); | 481 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), |
| 482 &rules); |
496 Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 483 Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
497 } | 484 } |
498 } | 485 } |
499 | 486 |
500 TabSpecificContentSettings::LocalSharedObjectsContainer:: | 487 TabSpecificContentSettings::LocalSharedObjectsContainer:: |
501 LocalSharedObjectsContainer(Profile* profile) | 488 LocalSharedObjectsContainer(Profile* profile) |
502 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), | 489 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), |
503 cookies_(new CannedBrowsingDataCookieHelper(profile)), | 490 cookies_(new CannedBrowsingDataCookieHelper(profile)), |
504 databases_(new CannedBrowsingDataDatabaseHelper(profile)), | 491 databases_(new CannedBrowsingDataDatabaseHelper(profile)), |
505 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), | 492 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), |
(...skipping 21 matching lines...) Expand all Loading... |
527 return new CookiesTreeModel(cookies_->Clone(), | 514 return new CookiesTreeModel(cookies_->Clone(), |
528 databases_->Clone(), | 515 databases_->Clone(), |
529 local_storages_->Clone(), | 516 local_storages_->Clone(), |
530 session_storages_->Clone(), | 517 session_storages_->Clone(), |
531 appcaches_->Clone(), | 518 appcaches_->Clone(), |
532 indexed_dbs_->Clone(), | 519 indexed_dbs_->Clone(), |
533 file_systems_->Clone(), | 520 file_systems_->Clone(), |
534 NULL, | 521 NULL, |
535 true); | 522 true); |
536 } | 523 } |
OLD | NEW |