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..7cae06f2d1dbde7331a8e429781c0b1a6280ac0a |
--- /dev/null |
+++ b/chrome/browser/ui/webui/quota_internals_ui.cc |
@@ -0,0 +1,56 @@ |
+// 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" |
+ |
+ |
michaeln
2011/05/26 20:28:31
extra blank lines
tzik
2011/05/27 14:53:59
Done.
|
+ |
+QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) |
+ : WebUI(contents) { |
+ // TODO(tzik): implement me |
+ // WebUIMessageHandler* handler = |
+ // new quota_internals::QuotaInternalsMessageHandler; |
+ // AddMessageHandler(handler->Attach(this)); |
michaeln
2011/05/26 20:28:31
maybe just leave a TODO without the comment out co
tzik
2011/05/27 14:53:59
Done.
|
+ 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, |
+ int request_id) OVERRIDE { |
+ base::StringPiece html( |
+ ResourceBundle::GetSharedInstance().GetRawDataResource( |
+ IDR_QUOTA_INTERNALS_INDEX_HTML)); |
+ std::string full_html(html.data(), html.size()); |
michaeln
2011/05/26 20:28:31
nit: maybe avoid the string copy, can html_bytes b
tzik
2011/05/27 14:53:59
Done.
|
+ |
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
+ html_bytes->data.resize(full_html.size()); |
+ std::copy(full_html.begin(), full_html.end(), 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 |
+ |