Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/local_data_container.h

Issue 10805015: Move browsing_data_helper files into a separate directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chrome_frame build Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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_LOCAL_DATA_CONTAINER_H_
6 #define CHROME_BROWSER_LOCAL_DATA_CONTAINER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/string16.h"
11 #include "chrome/browser/browsing_data_appcache_helper.h"
12 #include "chrome/browser/browsing_data_cookie_helper.h"
13 #include "chrome/browser/browsing_data_database_helper.h"
14 #include "chrome/browser/browsing_data_file_system_helper.h"
15 #include "chrome/browser/browsing_data_indexed_db_helper.h"
16 #include "chrome/browser/browsing_data_local_storage_helper.h"
17 #include "chrome/browser/browsing_data_quota_helper.h"
18 #include "chrome/browser/browsing_data_server_bound_cert_helper.h"
19 #include "net/base/server_bound_cert_store.h"
20
21 class LocalDataContainer;
22 class CookiesTreeModel;
23
24 namespace net {
25 class CanonicalCookie;
26 }
27
28 // Friendly typedefs for the multiple types of lists used in the model.
29 namespace {
30
31 typedef std::map<std::string, LocalDataContainer*> ContainerMap;
32 typedef std::list<net::CanonicalCookie> CookieList;
33 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> DatabaseInfoList;
34 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
35 LocalStorageInfoList;
36 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
37 SessionStorageInfoList;
38 typedef std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>
39 IndexedDBInfoList;
40 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo>
41 FileSystemInfoList;
42 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList;
43 typedef net::ServerBoundCertStore::ServerBoundCertList ServerBoundCertList;
44 typedef std::map<GURL, std::list<appcache::AppCacheInfo> > AppCacheInfoMap;
45
46 } // namespace
47
48 // LocalDataContainer ---------------------------------------------------------
49 // This class is a wrapper around all the BrowsingData*Helper classes. Because
50 // isolated applications have separate storage, we need different helper
51 // instances. As such, this class contains the app name and id, along with the
52 // helpers for all of the data types we need. The browser-wide "app id" will be
53 // the empty string, as no app can have an empty id.
54 class LocalDataContainer {
55 public:
56 LocalDataContainer(
57 const std::string& app_name,
58 const std::string& app_id,
59 BrowsingDataCookieHelper* cookie_helper,
60 BrowsingDataDatabaseHelper* database_helper,
61 BrowsingDataLocalStorageHelper* local_storage_helper,
62 BrowsingDataLocalStorageHelper* session_storage_helper,
63 BrowsingDataAppCacheHelper* appcache_helper,
64 BrowsingDataIndexedDBHelper* indexed_db_helper,
65 BrowsingDataFileSystemHelper* file_system_helper,
66 BrowsingDataQuotaHelper* quota_helper,
67 BrowsingDataServerBoundCertHelper* server_bound_cert_helper);
68 virtual ~LocalDataContainer();
69
70 // This method must be called to start the process of fetching the resources.
71 // The delegate passed in is called back to deliver the updates.
72 void Init(CookiesTreeModel* delegate);
73
74 const std::string& app_name() { return app_name_; }
75 const std::string& app_id() { return app_id_; }
76
77 private:
78 friend class CookiesTreeModel;
79 friend class CookieTreeAppCacheNode;
80 friend class CookieTreeCookieNode;
81 friend class CookieTreeDatabaseNode;
82 friend class CookieTreeLocalStorageNode;
83 friend class CookieTreeSessionStorageNode;
84 friend class CookieTreeIndexedDBNode;
85 friend class CookieTreeFileSystemNode;
86 friend class CookieTreeQuotaNode;
87 friend class CookieTreeServerBoundCertNode;
88
89 // Callback methods to be invoked when fetching the data is complete.
90 void OnAppCacheModelInfoLoaded();
91 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list);
92 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info);
93 void OnLocalStorageModelInfoLoaded(
94 const LocalStorageInfoList& local_storage_info);
95 void OnSessionStorageModelInfoLoaded(
96 const LocalStorageInfoList& local_storage_info);
97 void OnIndexedDBModelInfoLoaded(
98 const IndexedDBInfoList& indexed_db_info);
99 void OnFileSystemModelInfoLoaded(
100 const FileSystemInfoList& file_system_info);
101 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info);
102 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list);
103
104 // The app name and id, to which this container object is for.
105 std::string app_name_;
106 std::string app_id_;
107
108 // Pointers to the helper objects, needed to retreive all the types of locally
109 // stored data.
110 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_;
111 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_;
112 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_;
113 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_;
114 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_;
115 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_;
116 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_;
117 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_;
118 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_;
119
120 // Storage for all the data that was retrieved through the helper objects.
121 // The collected data is used for (re)creating the CookiesTreeModel.
122 AppCacheInfoMap appcache_info_;
123 CookieList cookie_list_;
124 DatabaseInfoList database_info_list_;
125 LocalStorageInfoList local_storage_info_list_;
126 LocalStorageInfoList session_storage_info_list_;
127 IndexedDBInfoList indexed_db_info_list_;
128 FileSystemInfoList file_system_info_list_;
129 QuotaInfoList quota_info_list_;
130 ServerBoundCertList server_bound_cert_list_;
131
132 // A delegate, which must outlive this object. The update callbacks use the
133 // delegate to deliver the updated data to the CookieTreeModel.
134 CookiesTreeModel* model_;
135
136 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_;
137
138 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer);
139 };
140
141 #endif // CHROME_BROWSER_LOCAL_DATA_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/browsing_data/browsing_data_test.cc ('k') | chrome/browser/local_data_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698