| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/message_loop_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "webkit/quota/quota_manager.h" | 18 #include "webkit/quota/quota_manager.h" |
| 19 #include "webkit/quota/quota_types.h" | 19 #include "webkit/quota/quota_types.h" |
| 20 | 20 |
| 21 namespace quota_internals { | 21 namespace quota_internals { |
| 22 | 22 |
| 23 class QuotaInternalsHandler; | 23 class QuotaInternalsHandler; |
| 24 class GlobalStorageInfo; | 24 class GlobalStorageInfo; |
| 25 class PerHostStorageInfo; | 25 class PerHostStorageInfo; |
| 26 class PerOriginStorageInfo; | 26 class PerOriginStorageInfo; |
| 27 typedef std::map<std::string, std::string> Statistics; | 27 typedef std::map<std::string, std::string> Statistics; |
| 28 | 28 |
| 29 // This class is the bridge between QuotaInternalsHandler and QuotaManager. | 29 // This class is the bridge between QuotaInternalsHandler and QuotaManager. |
| 30 // Each QuotaInternalsHandler instances creates and owns a instance of this | 30 // Each QuotaInternalsHandler instances creates and owns a instance of this |
| 31 // class. | 31 // class. |
| 32 class QuotaInternalsProxy | 32 class QuotaInternalsProxy |
| 33 : public base::RefCountedThreadSafe< | 33 : public base::RefCountedThreadSafe< |
| 34 QuotaInternalsProxy, | 34 QuotaInternalsProxy, |
| 35 content::BrowserThread::DeleteOnIOThread> { | 35 content::BrowserThread::DeleteOnIOThread> { |
| 36 public: | 36 public: |
| 37 explicit QuotaInternalsProxy(QuotaInternalsHandler* handler); | 37 explicit QuotaInternalsProxy(QuotaInternalsHandler* handler); |
| 38 ~QuotaInternalsProxy(); | |
| 39 | 38 |
| 40 void RequestInfo(scoped_refptr<quota::QuotaManager> quota_manager); | 39 void RequestInfo(scoped_refptr<quota::QuotaManager> quota_manager); |
| 41 | 40 |
| 42 private: | 41 private: |
| 42 friend struct content::BrowserThread::DeleteOnThread< |
| 43 content::BrowserThread::IO>; |
| 44 friend class base::DeleteHelper<QuotaInternalsProxy>; |
| 45 |
| 43 typedef quota::QuotaManager::QuotaTableEntries QuotaTableEntries; | 46 typedef quota::QuotaManager::QuotaTableEntries QuotaTableEntries; |
| 44 typedef quota::QuotaManager::OriginInfoTableEntries OriginInfoTableEntries; | 47 typedef quota::QuotaManager::OriginInfoTableEntries OriginInfoTableEntries; |
| 45 | 48 |
| 49 virtual ~QuotaInternalsProxy(); |
| 50 |
| 46 void ReportAvailableSpace(int64 available_space); | 51 void ReportAvailableSpace(int64 available_space); |
| 47 void ReportGlobalInfo(const GlobalStorageInfo& data); | 52 void ReportGlobalInfo(const GlobalStorageInfo& data); |
| 48 void ReportPerHostInfo(const std::vector<PerHostStorageInfo>& hosts); | 53 void ReportPerHostInfo(const std::vector<PerHostStorageInfo>& hosts); |
| 49 void ReportPerOriginInfo(const std::vector<PerOriginStorageInfo>& origins); | 54 void ReportPerOriginInfo(const std::vector<PerOriginStorageInfo>& origins); |
| 50 void ReportStatistics(const Statistics& stats); | 55 void ReportStatistics(const Statistics& stats); |
| 51 | 56 |
| 52 // Called on IO Thread by QuotaManager as callback. | 57 // Called on IO Thread by QuotaManager as callback. |
| 53 void DidGetAvailableSpace(quota::QuotaStatusCode status, int64 space); | 58 void DidGetAvailableSpace(quota::QuotaStatusCode status, int64 space); |
| 54 void DidGetGlobalQuota(quota::QuotaStatusCode status, | 59 void DidGetGlobalQuota(quota::QuotaStatusCode status, |
| 55 quota::StorageType type, | 60 quota::StorageType type, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 81 friend class QuotaInternalsHandler; | 86 friend class QuotaInternalsHandler; |
| 82 friend struct content::BrowserThread::DeleteOnThread< | 87 friend struct content::BrowserThread::DeleteOnThread< |
| 83 content::BrowserThread::IO>; | 88 content::BrowserThread::IO>; |
| 84 friend class base::DeleteHelper<QuotaInternalsProxy>; | 89 friend class base::DeleteHelper<QuotaInternalsProxy>; |
| 85 | 90 |
| 86 DISALLOW_COPY_AND_ASSIGN(QuotaInternalsProxy); | 91 DISALLOW_COPY_AND_ASSIGN(QuotaInternalsProxy); |
| 87 }; | 92 }; |
| 88 } // quota_internals | 93 } // quota_internals |
| 89 | 94 |
| 90 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ | 95 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_PROXY_H_ |
| OLD | NEW |