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 class Value; |
| 18 class ListValue; |
| 19 |
| 20 namespace quota_internals { |
| 21 |
| 22 class QuotaInternalsProxy; |
| 23 class GlobalData; |
| 24 class HostData; |
| 25 class OriginData; |
| 26 typedef std::map<std::string, std::string> Statistics; |
| 27 |
| 28 // This class handles message from WebUI page of chrome://quota-internals/. |
| 29 // All methods in this class can be called on UI thread. |
| 30 class QuotaInternalsHandler : public WebUIMessageHandler { |
| 31 public: |
| 32 QuotaInternalsHandler(); |
| 33 virtual ~QuotaInternalsHandler(); |
| 34 virtual void RegisterMessages() OVERRIDE; |
| 35 |
| 36 // Called by QuotaInternalsProxy to report information to WebUI page. |
| 37 void ReportAvailableSpace(int64 available_space); |
| 38 void ReportGlobalData(const GlobalData& data); |
| 39 void ReportHostData(const std::vector<HostData>& hosts); |
| 40 void ReportOriginData(const std::vector<OriginData>& origins); |
| 41 void ReportStatistics(const Statistics& stats); |
| 42 |
| 43 private: |
| 44 void OnRequestData(const ListValue*); |
| 45 void SendMessage(const std::string& message, const Value& value); |
| 46 |
| 47 scoped_refptr<QuotaInternalsProxy> proxy_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(QuotaInternalsHandler); |
| 50 }; |
| 51 |
| 52 } // quota_internals |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_HANDLER_H_ |
OLD | NEW |