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

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

Issue 523139: Adds local storage nodes to cookie tree model and cookies view. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 11 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) 2009 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_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
7
8 #include <string>
9
10 #include "base/file_path.h"
11 #include "base/scoped_ptr.h"
12 #include "base/task.h"
13
14 class Profile;
15
16 // This class fetches local storage information in the WebKit thread, and
17 // notifies the UI thread upon completion.
18 // A client of this class need to call StartFetching from the UI thread to
19 // initiate the flow, and it'll be notified by the callback in its UI
20 // thread at some later point.
21 // The client must call CancelNotification() if it's destroyed before the
22 // callback is notified.
23 class BrowsingDataLocalStorageHelper
24 : public base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper> {
25 public:
26 // Contains detailed information about local storage.
27 struct LocalStorageInfo {
28 LocalStorageInfo(
29 const std::string& protocol,
30 const std::string& host,
31 unsigned short port,
32 const std::string& database_identifier,
33 const std::string& origin,
34 const FilePath& file_path,
35 int64 size,
36 base::Time last_modified)
37 : protocol(protocol),
38 host(host),
39 port(port),
40 database_identifier(database_identifier),
41 origin(origin),
42 file_path(file_path),
43 size(size),
44 last_modified(last_modified) {
45 }
46
47 std::string protocol;
48 std::string host;
49 unsigned short port;
50 std::string database_identifier;
51 std::string origin;
52 FilePath file_path;
53 int64 size;
54 base::Time last_modified;
55 };
56
57 explicit BrowsingDataLocalStorageHelper(Profile* profile);
58
59 // Starts the fetching process, which will notify its completion via
60 // callback.
61 // This must be called only in the UI thread.
62 virtual void StartFetching(
63 Callback1<const std::vector<LocalStorageInfo>& >::Type* callback);
64 // Cancels the notification callback (i.e., the window that created it no
65 // longer exists).
66 // This must be called only in the UI thread.
67 virtual void CancelNotification();
68 // Requests a single local storage file to be deleted in the WEBKIT thread.
69 virtual void DeleteLocalStorageFile(const FilePath& file_path);
70 // Requests all local storage files to be deleted in the WEBKIT thread.
71 virtual void DeleteAllLocalStorageFiles();
72
73 private:
74 // Enumerates all local storage files in the WEBKIT thread.
75 void FetchLocalStorageInfoInWebKitThread();
76 // Notifies the completion callback in the UI thread.
77 void NotifyInUIThread();
78 // Delete a single local storage file in the WEBKIT thread.
79 void DeleteLocalStorageFileInWebKitThread(const FilePath& file_path);
80 // Delete all local storage files in the WEBKIT thread.
81 void DeleteAllLocalStorageFilesInWebKitThread();
82
83 Profile* profile_;
84 // This only mutates on the UI thread.
85 scoped_ptr<Callback1<const std::vector<LocalStorageInfo>& >::Type >
86 completion_callback_;
87 // Indicates whether or not we're currently fetching information:
88 // it's true when StartFetching() is called in the UI thread, and it's reset
89 // after we notified the callback in the UI thread.
90 // This only mutates on the UI thread.
91 bool is_fetching_;
92 // This only mutates in the WEBKIT thread.
93 std::vector<LocalStorageInfo> local_storage_info_;
94
95 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper);
96 };
97
98 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/browsing_data_local_storage_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698