| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/quota_internals_ui.h" | 5 #include "chrome/browser/ui/webui/quota_internals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 12 #include "chrome/browser/ui/webui/quota_internals_handler.h" |
| 11 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 12 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "content/common/json_value_serializer.h" | 15 #include "content/common/json_value_serializer.h" |
| 14 #include "grit/quota_internals_resources.h" | 16 #include "grit/quota_internals_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 17 | 19 |
| 18 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) | 20 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) |
| 19 : ChromeWebUI(contents) { | 21 : ChromeWebUI(contents) { |
| 20 // TODO(tzik): implement and attach message handler | 22 WebUIMessageHandler* handler = new quota_internals::QuotaInternalsHandler; |
| 23 AddMessageHandler(handler->Attach(this)); |
| 21 contents->profile()->GetChromeURLDataManager()-> | 24 contents->profile()->GetChromeURLDataManager()-> |
| 22 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); | 25 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); |
| 23 } | 26 } |
| 24 | 27 |
| 25 namespace quota_internals { | 28 namespace quota_internals { |
| 26 | 29 |
| 27 const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js"; | 30 const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js"; |
| 28 | 31 |
| 29 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() | 32 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() |
| 30 : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) { | 33 : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 | 44 |
| 42 std::string QuotaInternalsHTMLSource::GetMimeType( | 45 std::string QuotaInternalsHTMLSource::GetMimeType( |
| 43 const std::string& path) const { | 46 const std::string& path) const { |
| 44 if (path == kStringsJSPath) | 47 if (path == kStringsJSPath) |
| 45 return "application/javascript"; | 48 return "application/javascript"; |
| 46 else | 49 else |
| 47 return "text/html"; | 50 return "text/html"; |
| 48 } | 51 } |
| 49 | 52 |
| 50 } // namespace quota_internals | 53 } // namespace quota_internals |
| OLD | NEW |