summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/quota_internals_ui.cc
diff options
context:
space:
mode:
authortzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 19:49:31 +0000
committertzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 19:49:31 +0000
commitbc3f2a780ae85393475564c77afcfa682e63260a (patch)
treeb2ae535428c54a39ce03b8f80906e244b68ca87a /chrome/browser/ui/webui/quota_internals_ui.cc
parentdee810ea1b9b58410399bbc42637ffba79fde1c6 (diff)
downloadchromium_src-bc3f2a780ae85393475564c77afcfa682e63260a.zip
chromium_src-bc3f2a780ae85393475564c77afcfa682e63260a.tar.gz
chromium_src-bc3f2a780ae85393475564c77afcfa682e63260a.tar.bz2
Add chrome://quota-internals/ resources
(split from issue 7038034) BUG=84397 TEST=None Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=90447 Review URL: http://codereview.chromium.org/7053009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui/quota_internals_ui.cc')
-rw-r--r--chrome/browser/ui/webui/quota_internals_ui.cc50
1 files changed, 50 insertions, 0 deletions
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 0000000..4d4fcab
--- /dev/null
+++ b/chrome/browser/ui/webui/quota_internals_ui.cc
@@ -0,0 +1,50 @@
+// 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 "content/common/json_value_serializer.h"
+#include "grit/quota_internals_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+
+QuotaInternalsUI::QuotaInternalsUI(TabContents* contents)
+ : ChromeWebUI(contents) {
+ // TODO(tzik): implement and attach message handler
+ contents->profile()->GetChromeURLDataManager()->
+ AddDataSource(new quota_internals::QuotaInternalsHTMLSource);
+}
+
+namespace quota_internals {
+
+const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js";
+
+QuotaInternalsHTMLSource::QuotaInternalsHTMLSource()
+ : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) {
+}
+
+void QuotaInternalsHTMLSource::StartDataRequest(const std::string& path,
+ bool is_incognito,
+ int request_id) {
+ if (path == kStringsJSPath)
+ SendLocalizedStringsAsJSON(request_id);
+ else
+ SendFromResourceBundle(request_id, IDR_QUOTA_INTERNALS_MAIN_HTML);
+}
+
+std::string QuotaInternalsHTMLSource::GetMimeType(
+ const std::string& path) const {
+ if (path == kStringsJSPath)
+ return "application/javascript";
+ else
+ return "text/html";
+}
+
+} // namespace quota_internals