| 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 #include "chrome/browser/ui/webui/quota_internals_ui.h" | |
| 6 | |
| 7 #include <algorithm> | |
| 8 #include <string> | |
| 9 | |
| 10 #include "chrome/browser/profiles/profile.h" | |
| 11 #include "chrome/common/url_constants.h" | |
| 12 #include "content/browser/tab_contents/tab_contents.h" | |
| 13 #include "content/common/json_value_serializer.h" | |
| 14 #include "grit/quota_internals_resources.h" | |
| 15 #include "ui/base/l10n/l10n_util.h" | |
| 16 #include "ui/base/resource/resource_bundle.h" | |
| 17 | |
| 18 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) | |
| 19 : ChromeWebUI(contents) { | |
| 20 // TODO(tzik): implement and attach message handler | |
| 21 contents->profile()->GetChromeURLDataManager()-> | |
| 22 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); | |
| 23 } | |
| 24 | |
| 25 namespace quota_internals { | |
| 26 | |
| 27 const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js"; | |
| 28 | |
| 29 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() | |
| 30 : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) { | |
| 31 } | |
| 32 | |
| 33 void QuotaInternalsHTMLSource::StartDataRequest(const std::string& path, | |
| 34 bool is_incognito, | |
| 35 int request_id) OVERRIDE { | |
| 36 if (path == kStringsJSPath) | |
| 37 SendLocalizedStringsAsJSON(request_id); | |
| 38 else | |
| 39 SendFromResourceBundle(request_id, IDR_QUOTA_INTERNALS_MAIN_HTML); | |
| 40 } | |
| 41 | |
| 42 std::string QuotaInternalsHTMLSource::GetMimeType( | |
| 43 const std::string& path) const { | |
| 44 if (path == kStringsJSPath) | |
| 45 return "application/javascript"; | |
| 46 else | |
| 47 return "text/html"; | |
| 48 } | |
| 49 | |
| 50 } // namespace quota_internals | |
| OLD | NEW |