Home | History | Annotate | Download | only in content_settings
      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 CannedBrowsingDataCookieHelper;
     13 class CannedBrowsingDataDatabaseHelper;
     14 class CannedBrowsingDataFileSystemHelper;
     15 class CannedBrowsingDataIndexedDBHelper;
     16 class CannedBrowsingDataLocalStorageHelper;
     17 class CannedBrowsingDataServerBoundCertHelper;
     18 class CookiesTreeModel;
     19 class GURL;
     20 class Profile;
     21 
     22 class LocalSharedObjectsContainer {
     23  public:
     24   explicit LocalSharedObjectsContainer(Profile* profile);
     25   ~LocalSharedObjectsContainer();
     26 
     27   // Empties the container.
     28   void Reset();
     29 
     30   // Returns the number of objects stored in the container.
     31   size_t GetObjectCount() const;
     32 
     33   // Returns the number of objects for the given |origin|.
     34   size_t GetObjectCountForDomain(const GURL& url) const;
     35 
     36   // Creates a new CookiesTreeModel for all objects in the container,
     37   // copying each of them.
     38   scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel() const;
     39 
     40   CannedBrowsingDataAppCacheHelper* appcaches() const {
     41     return appcaches_.get();
     42   }
     43   CannedBrowsingDataCookieHelper* cookies() const { return cookies_.get(); }
     44   CannedBrowsingDataDatabaseHelper* databases() const {
     45     return databases_.get();
     46   }
     47   CannedBrowsingDataFileSystemHelper* file_systems() const {
     48     return file_systems_.get();
     49   }
     50   CannedBrowsingDataIndexedDBHelper* indexed_dbs() const {
     51     return indexed_dbs_.get();
     52   }
     53   CannedBrowsingDataLocalStorageHelper* local_storages() const {
     54     return local_storages_.get();
     55   }
     56   CannedBrowsingDataServerBoundCertHelper* server_bound_certs() const {
     57     return server_bound_certs_.get();
     58   }
     59   CannedBrowsingDataLocalStorageHelper* session_storages() const {
     60     return session_storages_.get();
     61   }
     62 
     63  private:
     64   scoped_refptr<CannedBrowsingDataAppCacheHelper> appcaches_;
     65   scoped_refptr<CannedBrowsingDataCookieHelper> cookies_;
     66   scoped_refptr<CannedBrowsingDataDatabaseHelper> databases_;
     67   scoped_refptr<CannedBrowsingDataFileSystemHelper> file_systems_;
     68   scoped_refptr<CannedBrowsingDataIndexedDBHelper> indexed_dbs_;
     69   scoped_refptr<CannedBrowsingDataLocalStorageHelper> local_storages_;
     70   scoped_refptr<CannedBrowsingDataServerBoundCertHelper> server_bound_certs_;
     71   scoped_refptr<CannedBrowsingDataLocalStorageHelper> session_storages_;
     72 
     73   DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsContainer);
     74 };
     75 
     76 #endif  // CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_
     77