| 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 400 } |
| 401 | 401 |
| 402 CookiesTreeModel* TabSpecificContentSettings::GetBlockedCookiesTreeModel() { | 402 CookiesTreeModel* TabSpecificContentSettings::GetBlockedCookiesTreeModel() { |
| 403 return blocked_local_shared_objects_.GetCookiesTreeModel(); | 403 return blocked_local_shared_objects_.GetCookiesTreeModel(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool TabSpecificContentSettings::OnMessageReceived( | 406 bool TabSpecificContentSettings::OnMessageReceived( |
| 407 const IPC::Message& message) { | 407 const IPC::Message& message) { |
| 408 bool handled = true; | 408 bool handled = true; |
| 409 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) | 409 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
| 410 IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) | 410 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, OnContentBlocked) |
| 411 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 411 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 412 IPC_MESSAGE_UNHANDLED(handled = false) | 412 IPC_MESSAGE_UNHANDLED(handled = false) |
| 413 IPC_END_MESSAGE_MAP() | 413 IPC_END_MESSAGE_MAP() |
| 414 return handled; | 414 return handled; |
| 415 } | 415 } |
| 416 | 416 |
| 417 void TabSpecificContentSettings::DidNavigateMainFramePostCommit( | 417 void TabSpecificContentSettings::DidNavigateMainFramePostCommit( |
| 418 const content::LoadCommittedDetails& details, | 418 const content::LoadCommittedDetails& details, |
| 419 const ViewHostMsg_FrameNavigate_Params& params) { | 419 const ViewHostMsg_FrameNavigate_Params& params) { |
| 420 if (!details.is_in_page) { | 420 if (!details.is_in_page) { |
| 421 // Clear "blocked" flags. | 421 // Clear "blocked" flags. |
| 422 ClearBlockedContentSettingsExceptForCookies(); | 422 ClearBlockedContentSettingsExceptForCookies(); |
| 423 GeolocationDidNavigate(details); | 423 GeolocationDidNavigate(details); |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 | 426 |
| 427 void TabSpecificContentSettings::RenderViewCreated( | 427 void TabSpecificContentSettings::RenderViewCreated( |
| 428 RenderViewHost* render_view_host) { | 428 RenderViewHost* render_view_host) { |
| 429 Profile* profile = | 429 Profile* profile = |
| 430 Profile::FromBrowserContext(tab_contents()->browser_context()); | 430 Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 431 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 431 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 432 render_view_host->Send(new ViewMsg_SetDefaultContentSettings( | 432 render_view_host->Send(new ChromeViewMsg_SetDefaultContentSettings( |
| 433 map->GetDefaultContentSettings())); | 433 map->GetDefaultContentSettings())); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( | 436 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( |
| 437 int64 frame_id, | 437 int64 frame_id, |
| 438 bool is_main_frame, | 438 bool is_main_frame, |
| 439 const GURL& validated_url, | 439 const GURL& validated_url, |
| 440 bool is_error_page, | 440 bool is_error_page, |
| 441 RenderViewHost* render_view_host) { | 441 RenderViewHost* render_view_host) { |
| 442 if (!is_main_frame) | 442 if (!is_main_frame) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 461 GURL entry_url; | 461 GURL entry_url; |
| 462 if (entry) | 462 if (entry) |
| 463 entry_url = entry->url(); | 463 entry_url = entry->url(); |
| 464 if (settings_details.ptr()->update_all() || | 464 if (settings_details.ptr()->update_all() || |
| 465 // The active NavigationEntry is the URL in the URL field of a tab. | 465 // The active NavigationEntry is the URL in the URL field of a tab. |
| 466 // Currently this should be matched by the |primary_pattern|. | 466 // Currently this should be matched by the |primary_pattern|. |
| 467 settings_details.ptr()->primary_pattern().Matches(entry_url)) { | 467 settings_details.ptr()->primary_pattern().Matches(entry_url)) { |
| 468 Profile* profile = | 468 Profile* profile = |
| 469 Profile::FromBrowserContext(tab_contents()->browser_context()); | 469 Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 470 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 470 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 471 Send(new ViewMsg_SetDefaultContentSettings( | 471 Send(new ChromeViewMsg_SetDefaultContentSettings( |
| 472 map->GetDefaultContentSettings())); | 472 map->GetDefaultContentSettings())); |
| 473 Send(new ViewMsg_SetContentSettingsForCurrentURL( | 473 Send(new ChromeViewMsg_SetContentSettingsForCurrentURL( |
| 474 entry_url, map->GetContentSettings(entry_url, entry_url))); | 474 entry_url, map->GetContentSettings(entry_url, entry_url))); |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 | 477 |
| 478 TabSpecificContentSettings::LocalSharedObjectsContainer:: | 478 TabSpecificContentSettings::LocalSharedObjectsContainer:: |
| 479 LocalSharedObjectsContainer(Profile* profile) | 479 LocalSharedObjectsContainer(Profile* profile) |
| 480 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), | 480 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), |
| 481 cookies_(new CannedBrowsingDataCookieHelper(profile)), | 481 cookies_(new CannedBrowsingDataCookieHelper(profile)), |
| 482 databases_(new CannedBrowsingDataDatabaseHelper(profile)), | 482 databases_(new CannedBrowsingDataDatabaseHelper(profile)), |
| 483 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), | 483 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 505 return new CookiesTreeModel(cookies_->Clone(), | 505 return new CookiesTreeModel(cookies_->Clone(), |
| 506 databases_->Clone(), | 506 databases_->Clone(), |
| 507 local_storages_->Clone(), | 507 local_storages_->Clone(), |
| 508 session_storages_->Clone(), | 508 session_storages_->Clone(), |
| 509 appcaches_->Clone(), | 509 appcaches_->Clone(), |
| 510 indexed_dbs_->Clone(), | 510 indexed_dbs_->Clone(), |
| 511 file_systems_->Clone(), | 511 file_systems_->Clone(), |
| 512 NULL, | 512 NULL, |
| 513 true); | 513 true); |
| 514 } | 514 } |
| OLD | NEW |