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