| 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 15 matching lines...) Expand all Loading... |
| 26 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
| 27 #include "content/browser/renderer_host/render_view_host_delegate.h" | 27 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 28 #include "content/public/browser/navigation_details.h" | 28 #include "content/public/browser/navigation_details.h" |
| 29 #include "content/public/browser/navigation_entry.h" | 29 #include "content/public/browser/navigation_entry.h" |
| 30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/browser/web_contents_delegate.h" | 32 #include "content/public/browser/web_contents_delegate.h" |
| 33 #include "webkit/fileapi/file_system_types.h" | 33 #include "webkit/fileapi/file_system_types.h" |
| 34 | 34 |
| 35 using content::BrowserThread; | 35 using content::BrowserThread; |
| 36 using content::NavigationEntry; |
| 36 using content::WebContents; | 37 using content::WebContents; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 typedef std::list<TabSpecificContentSettings*> TabSpecificList; | 40 typedef std::list<TabSpecificContentSettings*> TabSpecificList; |
| 40 static base::LazyInstance<TabSpecificList> g_tab_specific = | 41 static base::LazyInstance<TabSpecificList> g_tab_specific = |
| 41 LAZY_INSTANCE_INITIALIZER; | 42 LAZY_INSTANCE_INITIALIZER; |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool TabSpecificContentSettings::LocalSharedObjectsContainer::empty() const { | 45 bool TabSpecificContentSettings::LocalSharedObjectsContainer::empty() const { |
| 45 return appcaches_->empty() && | 46 return appcaches_->empty() && |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 462 } |
| 462 | 463 |
| 463 void TabSpecificContentSettings::Observe( | 464 void TabSpecificContentSettings::Observe( |
| 464 int type, | 465 int type, |
| 465 const content::NotificationSource& source, | 466 const content::NotificationSource& source, |
| 466 const content::NotificationDetails& details) { | 467 const content::NotificationDetails& details) { |
| 467 DCHECK(type == chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED); | 468 DCHECK(type == chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED); |
| 468 | 469 |
| 469 content::Details<const ContentSettingsDetails> settings_details(details); | 470 content::Details<const ContentSettingsDetails> settings_details(details); |
| 470 const NavigationController& controller = web_contents()->GetController(); | 471 const NavigationController& controller = web_contents()->GetController(); |
| 471 content::NavigationEntry* entry = controller.GetActiveEntry(); | 472 NavigationEntry* entry = controller.GetActiveEntry(); |
| 472 GURL entry_url; | 473 GURL entry_url; |
| 473 if (entry) | 474 if (entry) |
| 474 entry_url = entry->GetURL(); | 475 entry_url = entry->GetURL(); |
| 475 if (settings_details.ptr()->update_all() || | 476 if (settings_details.ptr()->update_all() || |
| 476 // The active NavigationEntry is the URL in the URL field of a tab. | 477 // The active NavigationEntry is the URL in the URL field of a tab. |
| 477 // Currently this should be matched by the |primary_pattern|. | 478 // Currently this should be matched by the |primary_pattern|. |
| 478 settings_details.ptr()->primary_pattern().Matches(entry_url)) { | 479 settings_details.ptr()->primary_pattern().Matches(entry_url)) { |
| 479 Profile* profile = | 480 Profile* profile = |
| 480 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 481 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 481 RendererContentSettingRules rules; | 482 RendererContentSettingRules rules; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return new CookiesTreeModel(cookies_->Clone(), | 516 return new CookiesTreeModel(cookies_->Clone(), |
| 516 databases_->Clone(), | 517 databases_->Clone(), |
| 517 local_storages_->Clone(), | 518 local_storages_->Clone(), |
| 518 session_storages_->Clone(), | 519 session_storages_->Clone(), |
| 519 appcaches_->Clone(), | 520 appcaches_->Clone(), |
| 520 indexed_dbs_->Clone(), | 521 indexed_dbs_->Clone(), |
| 521 file_systems_->Clone(), | 522 file_systems_->Clone(), |
| 522 NULL, | 523 NULL, |
| 523 true); | 524 true); |
| 524 } | 525 } |
| OLD | NEW |