1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ 6 #define CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ 7 8 #include "base/memory/ref_counted.h" 9 #include "base/memory/scoped_ptr.h" 10 11 class CannedBrowsingDataAppCacheHelper; 12 class CannedBrowsingDataChannelIDHelper; 13 class CannedBrowsingDataCookieHelper; 14 class CannedBrowsingDataDatabaseHelper; 15 class CannedBrowsingDataFileSystemHelper; 16 class CannedBrowsingDataIndexedDBHelper; 17 class CannedBrowsingDataLocalStorageHelper; 18 class CannedBrowsingDataServiceWorkerHelper; 19 class CookiesTreeModel; 20 class GURL; 21 class Profile; 22 23 class LocalSharedObjectsContainer { 24 public: 25 explicit LocalSharedObjectsContainer(Profile* profile); 26 ~LocalSharedObjectsContainer(); 27 28 // Empties the container. 29 void Reset(); 30 31 // Returns the number of objects stored in the container. 32 size_t GetObjectCount() const; 33 34 // Returns the number of objects for the given |origin|. 35 size_t GetObjectCountForDomain(const GURL& url) const; 36 37 // Creates a new CookiesTreeModel for all objects in the container, 38 // copying each of them. 39 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel() const; 40 appcaches()41 CannedBrowsingDataAppCacheHelper* appcaches() const { 42 return appcaches_.get(); 43 } channel_ids()44 CannedBrowsingDataChannelIDHelper* channel_ids() const { 45 return channel_ids_.get(); 46 } cookies()47 CannedBrowsingDataCookieHelper* cookies() const { return cookies_.get(); } databases()48 CannedBrowsingDataDatabaseHelper* databases() const { 49 return databases_.get(); 50 } file_systems()51 CannedBrowsingDataFileSystemHelper* file_systems() const { 52 return file_systems_.get(); 53 } indexed_dbs()54 CannedBrowsingDataIndexedDBHelper* indexed_dbs() const { 55 return indexed_dbs_.get(); 56 } local_storages()57 CannedBrowsingDataLocalStorageHelper* local_storages() const { 58 return local_storages_.get(); 59 } service_workers()60 CannedBrowsingDataServiceWorkerHelper* service_workers() const { 61 return service_workers_.get(); 62 } session_storages()63 CannedBrowsingDataLocalStorageHelper* session_storages() const { 64 return session_storages_.get(); 65 } 66 67 private: 68 scoped_refptr<CannedBrowsingDataAppCacheHelper> appcaches_; 69 scoped_refptr<CannedBrowsingDataChannelIDHelper> channel_ids_; 70 scoped_refptr<CannedBrowsingDataCookieHelper> cookies_; 71 scoped_refptr<CannedBrowsingDataDatabaseHelper> databases_; 72 scoped_refptr<CannedBrowsingDataFileSystemHelper> file_systems_; 73 scoped_refptr<CannedBrowsingDataIndexedDBHelper> indexed_dbs_; 74 scoped_refptr<CannedBrowsingDataLocalStorageHelper> local_storages_; 75 scoped_refptr<CannedBrowsingDataServiceWorkerHelper> service_workers_; 76 scoped_refptr<CannedBrowsingDataLocalStorageHelper> session_storages_; 77 78 DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsContainer); 79 }; 80 81 #endif // CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_ 82