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

Side by Side Diff: chrome/browser/ui/webui/quota_internals_proxy.h

Issue 7084024: Add chrome://quota-internals/ (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 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) 2011 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_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_
6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11 #include <string>
12 #include <vector>
13
14 #include "base/memory/ref_counted.h"
15 #include "content/browser/browser_thread.h"
16 #include "webkit/quota/quota_manager.h"
17 #include "webkit/quota/quota_types.h"
18
19 class Value;
20 class ListValue;
21
22 namespace quota_internals {
23
24 class QuotaInternalsHandler;
25 class GlobalData;
26 class HostData;
27 class OriginData;
28 typedef std::map<std::string, std::string> Statistics;
29
30 // This class is the bridge between QuotaInternalsHandler and QuotaManager.
31 // Each method can be called on specific thread.
32 class QuotaInternalsProxy
33 : public base::RefCountedThreadSafe<QuotaInternalsProxy,
34 BrowserThread::DeleteOnIOThread> {
35 public:
36 explicit QuotaInternalsProxy(QuotaInternalsHandler* handler);
37
38 // Called on UI Thread.
39 void RequestData(quota::QuotaManager* quota_manager);
40
41 private:
42 typedef quota::QuotaManager::QuotaTableEntries QuotaTableEntries;
43 typedef quota::QuotaManager::OriginInfoTableEntries OriginInfoTableEntries;
44
45 // Called on IO Thread.
46 void ReportAvailableSpace(int64 available_space);
47 void ReportGlobalData(const GlobalData& data);
48 void ReportHostData(const std::vector<HostData>& hosts);
49 void ReportOriginData(const std::vector<OriginData>& origins);
50 void ReportStatistics(const Statistics& stats);
51
52 // Called on UI Thread.
53 void RunReportAvailableSpaceOnUIThread(int64 available_space);
54 void RunReportGlobalDataOnUIThread(const GlobalData& data);
55 void RunReportHostDataOnUIThread(const std::vector<HostData>& hosts);
56 void RunReportOriginDataOnUIThread(const std::vector<OriginData>& origins);
57 void RunReportStatisticsOnUIThread(const Statistics& stats);
58
59 // Called on IO Thread.
60 void RunRequestDataOnIOThread();
61
62 // Called on IO Thread by QuotaManager as callback.
63 void DidGetAvailableSpace(quota::QuotaStatusCode status, int64 space);
64 void DidGetGlobalQuota(quota::QuotaStatusCode status,
65 quota::StorageType type,
66 int64 quota);
67 void DidGetGlobalUsage(quota::StorageType type,
68 int64 usage,
69 int64 unlimited_usage);
70 void DidDumpQuotaTable(const QuotaTableEntries& entries);
71 void DidDumpOriginInfoTable(const OriginInfoTableEntries& entries);
72 void DidGetHostUsage(const std::string& host,
73 quota::StorageType type,
74 int64 usage);
75
76 // Helper. Called on IO Thread.
77 void RequestPerOriginData(quota::StorageType type);
78 void VisitHost(const std::string& host, quota::StorageType type);
79 void GetHostUsage(const std::string& host, quota::StorageType type);
80
81 // Used on UI Thread.
82 QuotaInternalsHandler* handler_;
83
84 // Used on IO Thread.
85 base::ScopedCallbackFactory<QuotaInternalsProxy> callback_factory_;
86 scoped_refptr<quota::QuotaManager> quota_manager_;
87 std::set<std::pair<std::string, quota::StorageType> >
88 hosts_visited_, hosts_pending_;
89 std::vector<HostData> report_pending_;
90
91 friend class QuotaInternalsHandler;
92 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
93 friend class DeleteTask<QuotaInternalsProxy>;
94
95 DISALLOW_COPY_AND_ASSIGN(QuotaInternalsProxy);
96 };
97 } // quota_internals
98
99 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698