Index: chrome/browser/local_data_container.h |
diff --git a/chrome/browser/local_data_container.h b/chrome/browser/local_data_container.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c74aafe270b5d4a1ba6a7cc30c6d9f29dc9fcfb |
--- /dev/null |
+++ b/chrome/browser/local_data_container.h |
@@ -0,0 +1,132 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_LOCAL_DATA_CONTAINER_H_ |
+#define CHROME_BROWSER_LOCAL_DATA_CONTAINER_H_ |
+#pragma once |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/string16.h" |
+#include "chrome/browser/browsing_data_appcache_helper.h" |
+#include "chrome/browser/browsing_data_cookie_helper.h" |
+#include "chrome/browser/browsing_data_database_helper.h" |
+#include "chrome/browser/browsing_data_file_system_helper.h" |
+#include "chrome/browser/browsing_data_indexed_db_helper.h" |
+#include "chrome/browser/browsing_data_local_storage_helper.h" |
+#include "chrome/browser/browsing_data_quota_helper.h" |
+#include "chrome/browser/browsing_data_server_bound_cert_helper.h" |
+#include "net/base/server_bound_cert_store.h" |
+#include "net/cookies/cookie_monster.h" |
+ |
+class LocalDataContainer; |
+class CookiesTreeModelDelegate; |
+ |
+// Friendly typedefs for the multiple types of lists used in the model. |
+namespace { |
+ typedef std::map<std::string, LocalDataContainer*> ContainerMap; |
Evan Stade
2012/06/21 04:01:41
don't indent inside namespaces.
nasko
2012/06/21 16:22:12
Done.
|
+ typedef std::list<net::CookieMonster::CanonicalCookie> CookieList; |
+ typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> DatabaseInfoList; |
+ typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
+ LocalStorageInfoList; |
+ typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
+ SessionStorageInfoList; |
+ typedef std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> |
+ IndexedDBInfoList; |
+ typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> |
+ FileSystemInfoList; |
+ typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList; |
+ typedef net::ServerBoundCertStore::ServerBoundCertList ServerBoundCertList; |
+ |
+ typedef std::map<GURL, std::list<appcache::AppCacheInfo> > AppCacheInfoMap; |
+} |
James Hawkins
2012/06/21 00:04:12
nit: } // namespace
nasko
2012/06/21 16:22:12
Done.
|
+ |
+// LocalDataContainer --------------------------------------------------------- |
+// This class is a wrapper around all the BrowsingData*Helper classes. Because |
+// isolated applications have separate storage, we need different helper |
+// instances. As such, this class contains the app name and id, along with the |
+// helpers for all of the data types we need. The browser-wide "app id" will be |
+// the empty string, as no app can have empty id. |
+class LocalDataContainer { |
+ public: |
+ LocalDataContainer( |
+ const std::string& app_name, |
+ const std::string& app_id, |
+ BrowsingDataCookieHelper* cookie_helper, |
+ BrowsingDataDatabaseHelper* database_helper, |
+ BrowsingDataLocalStorageHelper* local_storage_helper, |
+ BrowsingDataLocalStorageHelper* session_storage_helper, |
+ BrowsingDataAppCacheHelper* appcache_helper, |
+ BrowsingDataIndexedDBHelper* indexed_db_helper, |
+ BrowsingDataFileSystemHelper* file_system_helper, |
+ BrowsingDataQuotaHelper* quota_helper, |
+ BrowsingDataServerBoundCertHelper* server_bound_cert_helper); |
+ virtual ~LocalDataContainer(); |
+ |
+ // This method must be called to start the process of fetching the resources. |
+ // The delegate passed in is called back to deliver the updates. |
+ void Init(CookiesTreeModelDelegate* delegate); |
+ |
+ const std::string& app_name() { return app_name_; } |
+ const std::string& app_id() { return app_id_; } |
+ |
+ private: |
+ void OnAppCacheModelInfoLoaded(); |
+ void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); |
+ void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
+ void OnLocalStorageModelInfoLoaded( |
+ const LocalStorageInfoList& local_storage_info); |
+ void OnSessionStorageModelInfoLoaded( |
+ const LocalStorageInfoList& local_storage_info); |
+ void OnIndexedDBModelInfoLoaded( |
+ const IndexedDBInfoList& indexed_db_info); |
+ void OnFileSystemModelInfoLoaded( |
+ const FileSystemInfoList& file_system_info); |
+ void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); |
+ void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); |
+ |
+ std::string app_name_; |
+ std::string app_id_; |
+ |
+ scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
+ scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
+ scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
+ scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
+ scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
+ scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
+ scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
+ scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
+ scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; |
+ |
+ AppCacheInfoMap appcache_info_; |
James Hawkins
2012/06/21 00:04:12
nit: This class is sorely lacking comments.
nasko
2012/06/21 16:22:12
Done.
|
+ CookieList cookie_list_; |
+ DatabaseInfoList database_info_list_; |
+ LocalStorageInfoList local_storage_info_list_; |
+ LocalStorageInfoList session_storage_info_list_; |
+ IndexedDBInfoList indexed_db_info_list_; |
+ FileSystemInfoList file_system_info_list_; |
+ QuotaInfoList quota_info_list_; |
+ ServerBoundCertList server_bound_cert_list_; |
+ |
+ // A delegate, which must outlive this object. The update callbacks use the |
+ // delegate to deliver the updated data to the CookieTreeModel. |
+ CookiesTreeModelDelegate* delegate_; |
+ |
+ base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; |
+ |
+ friend class CookiesTreeModel; |
James Hawkins
2012/06/21 00:04:12
nit: friends go at the top of the access section.
nasko
2012/06/21 16:22:12
Done.
|
+ friend class CookieTreeAppCacheNode; |
+ friend class CookieTreeCookieNode; |
+ friend class CookieTreeDatabaseNode; |
+ friend class CookieTreeLocalStorageNode; |
+ friend class CookieTreeSessionStorageNode; |
+ friend class CookieTreeIndexedDBNode; |
+ friend class CookieTreeFileSystemNode; |
+ friend class CookieTreeQuotaNode; |
+ friend class CookieTreeServerBoundCertNode; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); |
+}; |
+ |
+#endif // CHROME_BROWSER_LOCAL_DATA_CONTAINER_H_ |