OLD | NEW |
(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_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_HANDLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <map> |
| 10 #include <string> |
| 11 #include <vector> |
| 12 |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/webui/web_ui.h" |
| 15 #include "webkit/quota/quota_types.h" |
| 16 |
| 17 namespace base { |
| 18 class Value; |
| 19 class ListValue; |
| 20 } |
| 21 |
| 22 namespace quota_internals { |
| 23 |
| 24 class QuotaInternalsProxy; |
| 25 class GlobalStorageInfo; |
| 26 class PerHostStorageInfo; |
| 27 class PerOriginStorageInfo; |
| 28 typedef std::map<std::string, std::string> Statistics; |
| 29 |
| 30 // This class handles message from WebUI page of chrome://quota-internals/. |
| 31 // All methods in this class should be called on UI thread. |
| 32 class QuotaInternalsHandler : public WebUIMessageHandler { |
| 33 public: |
| 34 QuotaInternalsHandler(); |
| 35 virtual ~QuotaInternalsHandler(); |
| 36 virtual void RegisterMessages() OVERRIDE; |
| 37 |
| 38 // Called by QuotaInternalsProxy to report information to WebUI page. |
| 39 void ReportAvailableSpace(int64 available_space); |
| 40 void ReportGlobalInfo(const GlobalStorageInfo& data); |
| 41 void ReportPerHostInfo(const std::vector<PerHostStorageInfo>& hosts); |
| 42 void ReportPerOriginInfo(const std::vector<PerOriginStorageInfo>& origins); |
| 43 void ReportStatistics(const Statistics& stats); |
| 44 |
| 45 private: |
| 46 void OnRequestInfo(const base::ListValue*); |
| 47 void SendMessage(const std::string& message, const base::Value& value); |
| 48 |
| 49 scoped_refptr<QuotaInternalsProxy> proxy_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(QuotaInternalsHandler); |
| 52 }; |
| 53 } // quota_internals |
| 54 |
| 55 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_HANDLER_H_ |
OLD | NEW |