Commit 70b96fe8 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Move LocalSharedObjectsContainer to //components/browsing_data

This was in c/b/content_settings but seems to make more sense in
browsing_data since all the types it holds are in browsing data.

This moves CreateCookiesTreeModel() to collected_cookies_views.cc
since that's the only place it's used.

Bug: 1070825
Change-Id: Ib41e130fc77d492d691538d23cc4ef3e6cf4b696
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151328Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759649}
parent fa62c9de
...@@ -343,8 +343,6 @@ jumbo_static_library("browser") { ...@@ -343,8 +343,6 @@ jumbo_static_library("browser") {
"content_settings/cookie_settings_factory.h", "content_settings/cookie_settings_factory.h",
"content_settings/host_content_settings_map_factory.cc", "content_settings/host_content_settings_map_factory.cc",
"content_settings/host_content_settings_map_factory.h", "content_settings/host_content_settings_map_factory.h",
"content_settings/local_shared_objects_container.cc",
"content_settings/local_shared_objects_container.h",
"content_settings/mixed_content_settings_tab_helper.cc", "content_settings/mixed_content_settings_tab_helper.cc",
"content_settings/mixed_content_settings_tab_helper.h", "content_settings/mixed_content_settings_tab_helper.h",
"content_settings/sound_content_setting_observer.cc", "content_settings/sound_content_setting_observer.cc",
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browsing_data/browsing_data_file_system_util.h"
#include "chrome/browser/browsing_data/cookies_tree_model.h" #include "chrome/browser/browsing_data/cookies_tree_model.h"
#include "chrome/browser/content_settings/chrome_content_settings_utils.h" #include "chrome/browser/content_settings/chrome_content_settings_utils.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
...@@ -103,9 +104,11 @@ TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab) ...@@ -103,9 +104,11 @@ TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab)
map_(HostContentSettingsMapFactory::GetForProfile( map_(HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(tab->GetBrowserContext()))), Profile::FromBrowserContext(tab->GetBrowserContext()))),
allowed_local_shared_objects_( allowed_local_shared_objects_(
Profile::FromBrowserContext(tab->GetBrowserContext())), Profile::FromBrowserContext(tab->GetBrowserContext()),
browsing_data_file_system_util::GetAdditionalFileSystemTypes()),
blocked_local_shared_objects_( blocked_local_shared_objects_(
Profile::FromBrowserContext(tab->GetBrowserContext())), Profile::FromBrowserContext(tab->GetBrowserContext()),
browsing_data_file_system_util::GetAdditionalFileSystemTypes()),
geolocation_usages_state_(map_, ContentSettingsType::GEOLOCATION), geolocation_usages_state_(map_, ContentSettingsType::GEOLOCATION),
midi_usages_state_(map_, ContentSettingsType::MIDI_SYSEX), midi_usages_state_(map_, ContentSettingsType::MIDI_SYSEX),
pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()),
...@@ -345,9 +348,9 @@ void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { ...@@ -345,9 +348,9 @@ void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) {
void TabSpecificContentSettings::OnDomStorageAccessed(const GURL& url, void TabSpecificContentSettings::OnDomStorageAccessed(const GURL& url,
bool local, bool local,
bool blocked_by_policy) { bool blocked_by_policy) {
LocalSharedObjectsContainer& container = blocked_by_policy browsing_data::LocalSharedObjectsContainer& container =
? blocked_local_shared_objects_ blocked_by_policy ? blocked_local_shared_objects_
: allowed_local_shared_objects_; : allowed_local_shared_objects_;
browsing_data::CannedLocalStorageHelper* helper = browsing_data::CannedLocalStorageHelper* helper =
local ? container.local_storages() : container.session_storages(); local ? container.local_storages() : container.session_storages();
helper->Add(url::Origin::Create(url)); helper->Add(url::Origin::Create(url));
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h"
#include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/common/custom_handlers/protocol_handler.h"
#include "components/browsing_data/content/local_shared_objects_container.h"
#include "components/content_settings/core/browser/content_settings_observer.h" #include "components/content_settings/core/browser/content_settings_observer.h"
#include "components/content_settings/core/browser/content_settings_usages_state.h" #include "components/content_settings/core/browser/content_settings_usages_state.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
...@@ -266,11 +266,13 @@ class TabSpecificContentSettings ...@@ -266,11 +266,13 @@ class TabSpecificContentSettings
// Returns the |LocalSharedObjectsContainer| instances corresponding to all // Returns the |LocalSharedObjectsContainer| instances corresponding to all
// allowed, and blocked, respectively, local shared objects like cookies, // allowed, and blocked, respectively, local shared objects like cookies,
// local storage, ... . // local storage, ... .
const LocalSharedObjectsContainer& allowed_local_shared_objects() const { const browsing_data::LocalSharedObjectsContainer&
allowed_local_shared_objects() const {
return allowed_local_shared_objects_; return allowed_local_shared_objects_;
} }
const LocalSharedObjectsContainer& blocked_local_shared_objects() const { const browsing_data::LocalSharedObjectsContainer&
blocked_local_shared_objects() const {
return blocked_local_shared_objects_; return blocked_local_shared_objects_;
} }
...@@ -404,8 +406,8 @@ class TabSpecificContentSettings ...@@ -404,8 +406,8 @@ class TabSpecificContentSettings
HostContentSettingsMap* map_; HostContentSettingsMap* map_;
// Stores the blocked/allowed cookies. // Stores the blocked/allowed cookies.
LocalSharedObjectsContainer allowed_local_shared_objects_; browsing_data::LocalSharedObjectsContainer allowed_local_shared_objects_;
LocalSharedObjectsContainer blocked_local_shared_objects_; browsing_data::LocalSharedObjectsContainer blocked_local_shared_objects_;
// Manages information about Geolocation API usage in this page. // Manages information about Geolocation API usage in this page.
ContentSettingsUsagesState geolocation_usages_state_; ContentSettingsUsagesState geolocation_usages_state_;
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h" #include "base/metrics/user_metrics_action.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/cookie_controls/cookie_controls_service.h" #include "chrome/browser/ui/cookie_controls/cookie_controls_service.h"
#include "chrome/browser/ui/cookie_controls/cookie_controls_view.h" #include "chrome/browser/ui/cookie_controls/cookie_controls_view.h"
#include "components/browsing_data/content/local_shared_objects_container.h"
#include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/pref_names.h" #include "components/content_settings/core/common/pref_names.h"
...@@ -123,7 +123,7 @@ void CookieControlsController::OnCookieBlockingEnabledForSite( ...@@ -123,7 +123,7 @@ void CookieControlsController::OnCookieBlockingEnabledForSite(
} }
int CookieControlsController::GetBlockedCookieCount() { int CookieControlsController::GetBlockedCookieCount() {
const LocalSharedObjectsContainer& blocked_objects = const browsing_data::LocalSharedObjectsContainer& blocked_objects =
tab_observer_->tab_specific_content_settings() tab_observer_->tab_specific_content_settings()
->blocked_local_shared_objects(); ->blocked_local_shared_objects();
return blocked_objects.GetObjectCount(); return blocked_objects.GetObjectCount();
......
...@@ -90,13 +90,13 @@ void ChromePageInfoDelegate::ContentSettingChangedViaPageInfo( ...@@ -90,13 +90,13 @@ void ChromePageInfoDelegate::ContentSettingChangedViaPageInfo(
GetTabSpecificContentSettings()->ContentSettingChangedViaPageInfo(type); GetTabSpecificContentSettings()->ContentSettingChangedViaPageInfo(type);
} }
const LocalSharedObjectsContainer& ChromePageInfoDelegate::GetAllowedObjects( const browsing_data::LocalSharedObjectsContainer&
const GURL& site_url) { ChromePageInfoDelegate::GetAllowedObjects(const GURL& site_url) {
return GetTabSpecificContentSettings()->allowed_local_shared_objects(); return GetTabSpecificContentSettings()->allowed_local_shared_objects();
} }
const LocalSharedObjectsContainer& ChromePageInfoDelegate::GetBlockedObjects( const browsing_data::LocalSharedObjectsContainer&
const GURL& site_url) { ChromePageInfoDelegate::GetBlockedObjects(const GURL& site_url) {
return GetTabSpecificContentSettings()->blocked_local_shared_objects(); return GetTabSpecificContentSettings()->blocked_local_shared_objects();
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_PAGE_INFO_CHROME_PAGE_INFO_DELEGATE_H_ #define CHROME_BROWSER_UI_PAGE_INFO_CHROME_PAGE_INFO_DELEGATE_H_
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h" #include "components/browsing_data/content/local_shared_objects_container.h"
#include "components/page_info/page_info_delegate.h" #include "components/page_info/page_info_delegate.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
...@@ -74,8 +74,10 @@ class ChromePageInfoDelegate : public PageInfoDelegate { ...@@ -74,8 +74,10 @@ class ChromePageInfoDelegate : public PageInfoDelegate {
private: private:
TabSpecificContentSettings* GetTabSpecificContentSettings() const; TabSpecificContentSettings* GetTabSpecificContentSettings() const;
const LocalSharedObjectsContainer& GetAllowedObjects(const GURL& site_url); const browsing_data::LocalSharedObjectsContainer& GetAllowedObjects(
const LocalSharedObjectsContainer& GetBlockedObjects(const GURL& site_url); const GURL& site_url);
const browsing_data::LocalSharedObjectsContainer& GetBlockedObjects(
const GURL& site_url);
Profile* GetProfile() const; Profile* GetProfile() const;
#if BUILDFLAG(FULL_SAFE_BROWSING) #if BUILDFLAG(FULL_SAFE_BROWSING)
safe_browsing::ChromePasswordProtectionService* safe_browsing::ChromePasswordProtectionService*
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include <utility> #include <utility>
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
#include "chrome/browser/browsing_data/cookies_tree_model.h" #include "chrome/browser/browsing_data/cookies_tree_model.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "components/browsing_data/content/database_helper.h" #include "components/browsing_data/content/database_helper.h"
#include "components/browsing_data/content/file_system_helper.h" #include "components/browsing_data/content/file_system_helper.h"
#include "components/browsing_data/content/indexed_db_helper.h" #include "components/browsing_data/content/indexed_db_helper.h"
#include "components/browsing_data/content/local_shared_objects_container.h"
#include "components/browsing_data/content/local_storage_helper.h" #include "components/browsing_data/content/local_storage_helper.h"
#include "components/constrained_window/constrained_window_views.h" #include "components/constrained_window/constrained_window_views.h"
#include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/browser/cookie_settings.h"
...@@ -99,6 +100,21 @@ base::string16 GetAnnotationTextForSetting(ContentSetting setting) { ...@@ -99,6 +100,21 @@ base::string16 GetAnnotationTextForSetting(ContentSetting setting) {
} }
} }
// Creates a new CookiesTreeModel for all objects in the container,
// copying each of them.
std::unique_ptr<CookiesTreeModel> CreateCookiesTreeModel(
const browsing_data::LocalSharedObjectsContainer& shared_objects) {
auto container = std::make_unique<LocalDataContainer>(
shared_objects.cookies(), shared_objects.databases(),
shared_objects.local_storages(), shared_objects.session_storages(),
shared_objects.appcaches(), shared_objects.indexed_dbs(),
shared_objects.file_systems(), nullptr, shared_objects.service_workers(),
shared_objects.shared_workers(), shared_objects.cache_storages(), nullptr,
nullptr);
return std::make_unique<CookiesTreeModel>(std::move(container), nullptr);
}
} // namespace } // namespace
// This DrawingProvider allows TreeModelNodes to be annotated with auxiliary // This DrawingProvider allows TreeModelNodes to be annotated with auxiliary
...@@ -410,7 +426,7 @@ std::unique_ptr<views::View> CollectedCookiesViews::CreateAllowedPane() { ...@@ -410,7 +426,7 @@ std::unique_ptr<views::View> CollectedCookiesViews::CreateAllowedPane() {
allowed_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); allowed_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
allowed_cookies_tree_model_ = allowed_cookies_tree_model_ =
content_settings->allowed_local_shared_objects().CreateCookiesTreeModel(); CreateCookiesTreeModel(content_settings->allowed_local_shared_objects());
std::unique_ptr<CookiesTreeViewDrawingProvider> allowed_drawing_provider = std::unique_ptr<CookiesTreeViewDrawingProvider> allowed_drawing_provider =
std::make_unique<CookiesTreeViewDrawingProvider>(); std::make_unique<CookiesTreeViewDrawingProvider>();
allowed_cookies_drawing_provider_ = allowed_drawing_provider.get(); allowed_cookies_drawing_provider_ = allowed_drawing_provider.get();
...@@ -473,7 +489,7 @@ std::unique_ptr<views::View> CollectedCookiesViews::CreateBlockedPane() { ...@@ -473,7 +489,7 @@ std::unique_ptr<views::View> CollectedCookiesViews::CreateBlockedPane() {
blocked_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); blocked_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
blocked_label->SizeToFit(kTreeViewWidth); blocked_label->SizeToFit(kTreeViewWidth);
blocked_cookies_tree_model_ = blocked_cookies_tree_model_ =
content_settings->blocked_local_shared_objects().CreateCookiesTreeModel(); CreateCookiesTreeModel(content_settings->blocked_local_shared_objects());
std::unique_ptr<CookiesTreeViewDrawingProvider> blocked_drawing_provider = std::unique_ptr<CookiesTreeViewDrawingProvider> blocked_drawing_provider =
std::make_unique<CookiesTreeViewDrawingProvider>(); std::make_unique<CookiesTreeViewDrawingProvider>();
blocked_cookies_drawing_provider_ = blocked_drawing_provider.get(); blocked_cookies_drawing_provider_ = blocked_drawing_provider.get();
......
...@@ -22,6 +22,8 @@ static_library("content") { ...@@ -22,6 +22,8 @@ static_library("content") {
"file_system_helper.h", "file_system_helper.h",
"indexed_db_helper.cc", "indexed_db_helper.cc",
"indexed_db_helper.h", "indexed_db_helper.h",
"local_shared_objects_container.cc",
"local_shared_objects_container.h",
"local_storage_helper.cc", "local_storage_helper.cc",
"local_storage_helper.h", "local_storage_helper.h",
"service_worker_helper.cc", "service_worker_helper.cc",
......
...@@ -2,17 +2,13 @@ ...@@ -2,17 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/content_settings/local_shared_objects_container.h" #include "components/browsing_data/content/local_shared_objects_container.h"
#include <set> #include <set>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "chrome/browser/browsing_data/browsing_data_file_system_util.h"
#include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
#include "chrome/browser/browsing_data/cookies_tree_model.h"
#include "chrome/browser/profiles/profile.h"
#include "components/browsing_data/content/appcache_helper.h" #include "components/browsing_data/content/appcache_helper.h"
#include "components/browsing_data/content/cache_storage_helper.h" #include "components/browsing_data/content/cache_storage_helper.h"
#include "components/browsing_data/content/canonical_cookie_hash.h" #include "components/browsing_data/content/canonical_cookie_hash.h"
...@@ -23,6 +19,7 @@ ...@@ -23,6 +19,7 @@
#include "components/browsing_data/content/local_storage_helper.h" #include "components/browsing_data/content/local_storage_helper.h"
#include "components/browsing_data/content/service_worker_helper.h" #include "components/browsing_data/content/service_worker_helper.h"
#include "components/browsing_data/content/shared_worker_helper.h" #include "components/browsing_data/content/shared_worker_helper.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
...@@ -30,41 +27,45 @@ ...@@ -30,41 +27,45 @@
#include "net/cookies/cookie_util.h" #include "net/cookies/cookie_util.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace browsing_data {
namespace { namespace {
bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) { bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) {
return net::registry_controlled_domains::SameDomainOrHost( return net::registry_controlled_domains::SameDomainOrHost(
gurl1, gurl1, gurl2,
gurl2,
net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
} }
} // namespace } // namespace
LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) LocalSharedObjectsContainer::LocalSharedObjectsContainer(
: appcaches_(new browsing_data::CannedAppCacheHelper( content::BrowserContext* browser_context,
content::BrowserContext::GetDefaultStoragePartition(profile) const std::vector<storage::FileSystemType>& additional_file_system_types)
: appcaches_(new CannedAppCacheHelper(
content::BrowserContext::GetDefaultStoragePartition(browser_context)
->GetAppCacheService())), ->GetAppCacheService())),
cookies_(new browsing_data::CannedCookieHelper( cookies_(new CannedCookieHelper(
content::BrowserContext::GetDefaultStoragePartition(profile))), content::BrowserContext::GetDefaultStoragePartition(
databases_(new browsing_data::CannedDatabaseHelper(profile)), browser_context))),
file_systems_(new browsing_data::CannedFileSystemHelper( databases_(new CannedDatabaseHelper(browser_context)),
content::BrowserContext::GetDefaultStoragePartition(profile) file_systems_(new CannedFileSystemHelper(
content::BrowserContext::GetDefaultStoragePartition(browser_context)
->GetFileSystemContext(), ->GetFileSystemContext(),
browsing_data_file_system_util::GetAdditionalFileSystemTypes())), additional_file_system_types)),
indexed_dbs_(new browsing_data::CannedIndexedDBHelper( indexed_dbs_(new CannedIndexedDBHelper(
content::BrowserContext::GetDefaultStoragePartition(profile))), content::BrowserContext::GetDefaultStoragePartition(
local_storages_(new browsing_data::CannedLocalStorageHelper(profile)), browser_context))),
service_workers_(new browsing_data::CannedServiceWorkerHelper( local_storages_(new CannedLocalStorageHelper(browser_context)),
content::BrowserContext::GetDefaultStoragePartition(profile) service_workers_(new CannedServiceWorkerHelper(
content::BrowserContext::GetDefaultStoragePartition(browser_context)
->GetServiceWorkerContext())), ->GetServiceWorkerContext())),
shared_workers_(new browsing_data::CannedSharedWorkerHelper( shared_workers_(new CannedSharedWorkerHelper(
content::BrowserContext::GetDefaultStoragePartition(profile), content::BrowserContext::GetDefaultStoragePartition(browser_context),
profile->GetResourceContext())), browser_context->GetResourceContext())),
cache_storages_(new browsing_data::CannedCacheStorageHelper( cache_storages_(new CannedCacheStorageHelper(
content::BrowserContext::GetDefaultStoragePartition(profile) content::BrowserContext::GetDefaultStoragePartition(browser_context)
->GetCacheStorageContext())), ->GetCacheStorageContext())),
session_storages_(new browsing_data::CannedLocalStorageHelper(profile)) {} session_storages_(new CannedLocalStorageHelper(browser_context)) {}
LocalSharedObjectsContainer::~LocalSharedObjectsContainer() = default; LocalSharedObjectsContainer::~LocalSharedObjectsContainer() = default;
...@@ -92,8 +93,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain( ...@@ -92,8 +93,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain(
// to be a third party regarding the domain of the provided |origin|. E.g. if // to be a third party regarding the domain of the provided |origin|. E.g. if
// the origin is "http://foo.com" then all cookies with domain foo.com, // the origin is "http://foo.com" then all cookies with domain foo.com,
// a.foo.com, b.a.foo.com or *.foo.com will be counted. // a.foo.com, b.a.foo.com or *.foo.com will be counted.
typedef browsing_data::CannedCookieHelper::OriginCookieSetMap typedef CannedCookieHelper::OriginCookieSetMap OriginCookieSetMap;
OriginCookieSetMap;
const OriginCookieSetMap& origin_cookies_set_map = const OriginCookieSetMap& origin_cookies_set_map =
cookies()->origin_cookie_set_map(); cookies()->origin_cookie_set_map();
for (auto it = origin_cookies_set_map.begin(); for (auto it = origin_cookies_set_map.begin();
...@@ -140,7 +140,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain( ...@@ -140,7 +140,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain(
} }
// Count shared workers for the domain of the given |origin|. // Count shared workers for the domain of the given |origin|.
typedef browsing_data::SharedWorkerHelper::SharedWorkerInfo SharedWorkerInfo; typedef SharedWorkerHelper::SharedWorkerInfo SharedWorkerInfo;
const std::set<SharedWorkerInfo>& shared_worker_info = const std::set<SharedWorkerInfo>& shared_worker_info =
shared_workers()->GetSharedWorkerInfo(); shared_workers()->GetSharedWorkerInfo();
for (const auto& it : shared_worker_info) { for (const auto& it : shared_worker_info) {
...@@ -236,12 +236,4 @@ void LocalSharedObjectsContainer::Reset() { ...@@ -236,12 +236,4 @@ void LocalSharedObjectsContainer::Reset() {
session_storages_->Reset(); session_storages_->Reset();
} }
std::unique_ptr<CookiesTreeModel> } // namespace browsing_data
LocalSharedObjectsContainer::CreateCookiesTreeModel() const {
auto container = std::make_unique<LocalDataContainer>(
cookies_, databases_, local_storages_, session_storages_, appcaches_,
indexed_dbs_, file_systems_, nullptr, service_workers_, shared_workers_,
cache_storages_, nullptr, nullptr);
return std::make_unique<CookiesTreeModel>(std::move(container), nullptr);
}
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ #ifndef COMPONENTS_BROWSING_DATA_CONTENT_LOCAL_SHARED_OBJECTS_CONTAINER_H_
#define CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ #define COMPONENTS_BROWSING_DATA_CONTENT_LOCAL_SHARED_OBJECTS_CONTAINER_H_
#include <stddef.h> #include <stddef.h>
...@@ -11,10 +11,13 @@ ...@@ -11,10 +11,13 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "storage/common/file_system/file_system_types.h"
class CookiesTreeModel;
class GURL; class GURL;
class Profile;
namespace content {
class BrowserContext;
}
namespace browsing_data { namespace browsing_data {
class CannedAppCacheHelper; class CannedAppCacheHelper;
...@@ -26,11 +29,12 @@ class CannedIndexedDBHelper; ...@@ -26,11 +29,12 @@ class CannedIndexedDBHelper;
class CannedServiceWorkerHelper; class CannedServiceWorkerHelper;
class CannedSharedWorkerHelper; class CannedSharedWorkerHelper;
class CannedLocalStorageHelper; class CannedLocalStorageHelper;
}
class LocalSharedObjectsContainer { class LocalSharedObjectsContainer {
public: public:
explicit LocalSharedObjectsContainer(Profile* profile); explicit LocalSharedObjectsContainer(
content::BrowserContext* browser_context,
const std::vector<storage::FileSystemType>& additional_file_system_types);
~LocalSharedObjectsContainer(); ~LocalSharedObjectsContainer();
// Returns the number of objects stored in the container. // Returns the number of objects stored in the container.
...@@ -45,52 +49,42 @@ class LocalSharedObjectsContainer { ...@@ -45,52 +49,42 @@ class LocalSharedObjectsContainer {
// Empties the container. // Empties the container.
void Reset(); void Reset();
// Creates a new CookiesTreeModel for all objects in the container, CannedAppCacheHelper* appcaches() const { return appcaches_.get(); }
// copying each of them. CannedCookieHelper* cookies() const { return cookies_.get(); }
std::unique_ptr<CookiesTreeModel> CreateCookiesTreeModel() const; CannedDatabaseHelper* databases() const { return databases_.get(); }
CannedFileSystemHelper* file_systems() const { return file_systems_.get(); }
browsing_data::CannedAppCacheHelper* appcaches() const { CannedIndexedDBHelper* indexed_dbs() const { return indexed_dbs_.get(); }
return appcaches_.get(); CannedLocalStorageHelper* local_storages() const {
}
browsing_data::CannedCookieHelper* cookies() const { return cookies_.get(); }
browsing_data::CannedDatabaseHelper* databases() const {
return databases_.get();
}
browsing_data::CannedFileSystemHelper* file_systems() const {
return file_systems_.get();
}
browsing_data::CannedIndexedDBHelper* indexed_dbs() const {
return indexed_dbs_.get();
}
browsing_data::CannedLocalStorageHelper* local_storages() const {
return local_storages_.get(); return local_storages_.get();
} }
browsing_data::CannedServiceWorkerHelper* service_workers() const { CannedServiceWorkerHelper* service_workers() const {
return service_workers_.get(); return service_workers_.get();
} }
browsing_data::CannedSharedWorkerHelper* shared_workers() const { CannedSharedWorkerHelper* shared_workers() const {
return shared_workers_.get(); return shared_workers_.get();
} }
browsing_data::CannedCacheStorageHelper* cache_storages() const { CannedCacheStorageHelper* cache_storages() const {
return cache_storages_.get(); return cache_storages_.get();
} }
browsing_data::CannedLocalStorageHelper* session_storages() const { CannedLocalStorageHelper* session_storages() const {
return session_storages_.get(); return session_storages_.get();
} }
private: private:
scoped_refptr<browsing_data::CannedAppCacheHelper> appcaches_; scoped_refptr<CannedAppCacheHelper> appcaches_;
scoped_refptr<browsing_data::CannedCookieHelper> cookies_; scoped_refptr<CannedCookieHelper> cookies_;
scoped_refptr<browsing_data::CannedDatabaseHelper> databases_; scoped_refptr<CannedDatabaseHelper> databases_;
scoped_refptr<browsing_data::CannedFileSystemHelper> file_systems_; scoped_refptr<CannedFileSystemHelper> file_systems_;
scoped_refptr<browsing_data::CannedIndexedDBHelper> indexed_dbs_; scoped_refptr<CannedIndexedDBHelper> indexed_dbs_;
scoped_refptr<browsing_data::CannedLocalStorageHelper> local_storages_; scoped_refptr<CannedLocalStorageHelper> local_storages_;
scoped_refptr<browsing_data::CannedServiceWorkerHelper> service_workers_; scoped_refptr<CannedServiceWorkerHelper> service_workers_;
scoped_refptr<browsing_data::CannedSharedWorkerHelper> shared_workers_; scoped_refptr<CannedSharedWorkerHelper> shared_workers_;
scoped_refptr<browsing_data::CannedCacheStorageHelper> cache_storages_; scoped_refptr<CannedCacheStorageHelper> cache_storages_;
scoped_refptr<browsing_data::CannedLocalStorageHelper> session_storages_; scoped_refptr<CannedLocalStorageHelper> session_storages_;
DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsContainer); DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsContainer);
}; };
#endif // CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ } // namespace browsing_data
#endif // COMPONENTS_BROWSING_DATA_CONTENT_LOCAL_SHARED_OBJECTS_CONTAINER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment