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 "grit/quota_internals_resources.h" | |
14 #include "ui/base/resource/resource_bundle.h" | |
15 | |
16 QuotaInternalsUI::QuotaInternalsUI(TabContents* contents) | |
17 : WebUI(contents) { | |
18 // TODO(tzik): implement and attach message handler | |
19 contents->profile()->GetChromeURLDataManager()-> | |
20 AddDataSource(new quota_internals::QuotaInternalsHTMLSource); | |
21 } | |
22 | |
23 namespace quota_internals { | |
24 | |
25 QuotaInternalsHTMLSource::QuotaInternalsHTMLSource() | |
26 : DataSource(chrome::kChromeUIQuotaInternalsHost, | |
27 MessageLoop::current()) { | |
28 } | |
29 | |
30 void QuotaInternalsHTMLSource::StartDataRequest(const std::string& path, | |
31 bool is_incognito, | |
Evan Stade
2011/06/01 00:48:25
indentation is off
tzik
2011/06/03 16:13:47
Done.
| |
32 int request_id) OVERRIDE { | |
33 base::StringPiece html( | |
34 ResourceBundle::GetSharedInstance().GetRawDataResource( | |
35 IDR_QUOTA_INTERNALS_INDEX_HTML)); | |
36 | |
37 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | |
38 html_bytes->data.resize(html.size()); | |
39 std::copy(html.data(), html.data() + html.size(), html_bytes->data.begin()); | |
40 SendResponse(request_id, html_bytes); | |
41 return; | |
42 } | |
43 | |
44 std::string QuotaInternalsHTMLSource::GetMimeType( | |
45 const std::string& path_unused) const { | |
46 return "text/html"; | |
47 } | |
48 | |
49 } // namespace quota_internals | |
OLD | NEW |