Index: chrome/browser/ui/webui/quota_internals_ui.cc |
diff --git a/chrome/browser/ui/webui/quota_internals_ui.cc b/chrome/browser/ui/webui/quota_internals_ui.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..30c68d4ae8aeba74d64f475fe6fcc2c14d4d7182 |
--- /dev/null |
+++ b/chrome/browser/ui/webui/quota_internals_ui.cc |
@@ -0,0 +1,49 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/webui/quota_internals_ui.h" |
+ |
+#include <algorithm> |
+#include <string> |
+ |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/url_constants.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
+#include "grit/quota_internals_resources.h" |
+#include "ui/base/resource/resource_bundle.h" |
+ |
+QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) |
+ : WebUI(contents) { |
+ // TODO(tzik): implement and attach message handler |
+ contents->profile()->GetChromeURLDataManager()-> |
+ AddDataSource(new quota_internals::QuotaInternalsHTMLSource); |
+} |
+ |
+namespace quota_internals { |
+ |
+QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() |
+ : DataSource(chrome::kChromeUIQuotaInternalsHost, |
+ MessageLoop::current()) { |
+} |
+ |
+void QuotaInternalsHTMLSource::StartDataRequest(const std::string& path, |
+ bool is_incognito, |
Evan Stade
2011/06/01 00:48:25
indentation is off
tzik
2011/06/03 16:13:47
Done.
|
+ int request_id) OVERRIDE { |
+ base::StringPiece html( |
+ ResourceBundle::GetSharedInstance().GetRawDataResource( |
+ IDR_QUOTA_INTERNALS_INDEX_HTML)); |
+ |
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
+ html_bytes->data.resize(html.size()); |
+ std::copy(html.data(), html.data() + html.size(), html_bytes->data.begin()); |
+ SendResponse(request_id, html_bytes); |
+ return; |
+} |
+ |
+std::string QuotaInternalsHTMLSource::GetMimeType( |
+ const std::string& path_unused) const { |
+ return "text/html"; |
+} |
+ |
+} // namespace quota_internals |