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

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

Issue 10092013: Display third party cookies and site data counts in the WebsiteSettings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 17 matching lines...) Expand all
28 // This class fetches local storage information in the WebKit thread, and 28 // This class fetches local storage information in the WebKit thread, and
29 // notifies the UI thread upon completion. 29 // notifies the UI thread upon completion.
30 // A client of this class need to call StartFetching from the UI thread to 30 // A client of this class need to call StartFetching from the UI thread to
31 // initiate the flow, and it'll be notified by the callback in its UI 31 // initiate the flow, and it'll be notified by the callback in its UI
32 // thread at some later point. 32 // thread at some later point.
33 class BrowsingDataLocalStorageHelper 33 class BrowsingDataLocalStorageHelper
34 : public base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper> { 34 : public base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper> {
35 public: 35 public:
36 // Contains detailed information about local storage. 36 // Contains detailed information about local storage.
37 struct LocalStorageInfo { 37 struct LocalStorageInfo {
38 LocalStorageInfo();
39 LocalStorageInfo( 38 LocalStorageInfo(
40 const std::string& protocol, 39 const std::string& protocol,
41 const std::string& host, 40 const std::string& host,
42 unsigned short port, 41 unsigned short port,
43 const std::string& database_identifier, 42 const std::string& database_identifier,
44 const std::string& origin, 43 const std::string& origin,
45 const FilePath& file_path, 44 const FilePath& file_path,
46 int64 size, 45 int64 size,
47 base::Time last_modified); 46 base::Time last_modified);
48 ~LocalStorageInfo(); 47 ~LocalStorageInfo();
(...skipping 30 matching lines...) Expand all
79 78
80 // This only mutates on the UI thread. 79 // This only mutates on the UI thread.
81 base::Callback<void(const std::list<LocalStorageInfo>&)> completion_callback_; 80 base::Callback<void(const std::list<LocalStorageInfo>&)> completion_callback_;
82 81
83 // Indicates whether or not we're currently fetching information: 82 // Indicates whether or not we're currently fetching information:
84 // it's true when StartFetching() is called in the UI thread, and it's reset 83 // it's true when StartFetching() is called in the UI thread, and it's reset
85 // after we notified the callback in the UI thread. 84 // after we notified the callback in the UI thread.
86 // This only mutates on the UI thread. 85 // This only mutates on the UI thread.
87 bool is_fetching_; 86 bool is_fetching_;
88 87
89 // This only mutates in the WEBKIT thread. 88 // Access to |local_storage_info_| is triggered indirectly via the UI thread
89 // and guarded by |is_fetching_|. This means |local_storage_info_| is only
90 // accessed while |is_fetching_| is true. The flag |is_fetching_| is only
91 // accessed on the UI thread.
Bernhard Bauer 2012/05/14 13:29:04 Nice :)
markusheintz_ 2012/05/14 15:06:45 Thanks
90 std::list<LocalStorageInfo> local_storage_info_; 92 std::list<LocalStorageInfo> local_storage_info_;
91 93
92 private: 94 private:
93 // Called back with the all the local storage files. 95 // Called back with all the local storage files.
94 void GetAllStorageFilesCallback(const std::vector<FilePath>& files); 96 void GetAllStorageFilesCallback(const std::vector<FilePath>& files);
95 // Get the file info on the file thread. 97 // Get the file info on the file thread.
96 void FetchLocalStorageInfo(const std::vector<FilePath>& files); 98 void FetchLocalStorageInfo(const std::vector<FilePath>& files);
97 99
98 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); 100 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper);
99 }; 101 };
100 102
101 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does 103 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does
102 // not fetch its information from the local storage tracker, but gets them 104 // not fetch its information from the local storage tracker, but gets them
103 // passed as a parameter during construction. 105 // passed as a parameter during construction.
(...skipping 13 matching lines...) Expand all
117 119
118 // Clear the list of canned local storages. 120 // Clear the list of canned local storages.
119 void Reset(); 121 void Reset();
120 122
121 // True if no local storages are currently stored. 123 // True if no local storages are currently stored.
122 bool empty() const; 124 bool empty() const;
123 125
124 // Returns the number of local storages currently stored. 126 // Returns the number of local storages currently stored.
125 size_t GetLocalStorageCount() const; 127 size_t GetLocalStorageCount() const;
126 128
129 // Returns the set of origins that use local storage.
130 const std::set<GURL>& GetLocalStorageInfo() const;
131
127 // BrowsingDataLocalStorageHelper implementation. 132 // BrowsingDataLocalStorageHelper implementation.
128 virtual void StartFetching( 133 virtual void StartFetching(
129 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) 134 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback)
130 OVERRIDE; 135 OVERRIDE;
131 136
132 private: 137 private:
133 virtual ~CannedBrowsingDataLocalStorageHelper(); 138 virtual ~CannedBrowsingDataLocalStorageHelper();
134 139
135 // Convert the pending local storage info to local storage info objects. 140 // Convert the pending local storage info to local storage info objects.
136 void ConvertPendingInfo(); 141 void ConvertPendingInfo();
137 142
138 std::set<GURL> pending_local_storage_info_; 143 std::set<GURL> pending_local_storage_info_;
139 144
140 Profile* profile_; 145 Profile* profile_;
141 146
142 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); 147 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper);
143 }; 148 };
144 149
145 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ 150 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_indexed_db_helper.cc ('k') | chrome/browser/browsing_data_local_storage_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698