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> | |
8 #include <string> | 7 #include <string> |
9 | 8 |
10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 11 #include "chrome/browser/ui/webui/quota_internals_handler.h" |
11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/browser/tab_contents/tab_contents.h" |
13 #include "content/common/json_value_serializer.h" | 14 #include "content/common/json_value_serializer.h" |
14 #include "grit/quota_internals_resources.h" | 15 #include "grit/quota_internals_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 | 18 |
18 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) | 19 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) |
19 : ChromeWebUI(contents) { | 20 : ChromeWebUI(contents) { |
20 // TODO(tzik): implement and attach message handler | 21 WebUIMessageHandler* handler = new quota_internals::QuotaInternalsHandler; |
| 22 AddMessageHandler(handler->Attach(this)); |
21 contents->profile()->GetChromeURLDataManager()-> | 23 contents->profile()->GetChromeURLDataManager()-> |
22 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); | 24 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); |
23 } | 25 } |
24 | 26 |
25 namespace quota_internals { | 27 namespace quota_internals { |
26 | 28 |
27 const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js"; | 29 const char QuotaInternalsHTMLSource::kStringsJSPath[] = "strings.js"; |
28 | 30 |
29 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() | 31 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() |
30 : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) { | 32 : ChromeWebUIDataSource(chrome::kChromeUIQuotaInternalsHost) { |
(...skipping 10 matching lines...) Expand all Loading... |
41 | 43 |
42 std::string QuotaInternalsHTMLSource::GetMimeType( | 44 std::string QuotaInternalsHTMLSource::GetMimeType( |
43 const std::string& path) const { | 45 const std::string& path) const { |
44 if (path == kStringsJSPath) | 46 if (path == kStringsJSPath) |
45 return "application/javascript"; | 47 return "application/javascript"; |
46 else | 48 else |
47 return "text/html"; | 49 return "text/html"; |
48 } | 50 } |
49 | 51 |
50 } // namespace quota_internals | 52 } // namespace quota_internals |
OLD | NEW |