Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/ui/webui/media/media_internals_ui.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/history2_ui.cc ('k') | chrome/browser/ui/webui/net_internals_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/media/media_internals_ui.h" 5 #include "chrome/browser/ui/webui/media/media_internals_ui.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 base::StringPiece html_template( 51 base::StringPiece html_template(
52 ResourceBundle::GetSharedInstance().GetRawDataResource( 52 ResourceBundle::GetSharedInstance().GetRawDataResource(
53 IDR_MEDIA_INTERNALS_HTML)); 53 IDR_MEDIA_INTERNALS_HTML));
54 std::string html(html_template.data(), html_template.size()); 54 std::string html(html_template.data(), html_template.size());
55 jstemplate_builder::AppendI18nTemplateSourceHtml(&html); 55 jstemplate_builder::AppendI18nTemplateSourceHtml(&html);
56 jstemplate_builder::AppendJsTemplateSourceHtml(&html); 56 jstemplate_builder::AppendJsTemplateSourceHtml(&html);
57 jstemplate_builder::AppendJsonHtml(&localized_strings, &html); 57 jstemplate_builder::AppendJsonHtml(&localized_strings, &html);
58 jstemplate_builder::AppendI18nTemplateProcessHtml(&html); 58 jstemplate_builder::AppendI18nTemplateProcessHtml(&html);
59 59
60 scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes()); 60 SendResponse(request_id, base::RefCountedString::TakeString(&html));
61 bytes->data.resize(html.size());
62 std::copy(html.begin(), html.end(), bytes->data.begin());
63
64 SendResponse(request_id, bytes);
65 } 61 }
66 62
67 std::string MediaInternalsHTMLSource::GetMimeType( 63 std::string MediaInternalsHTMLSource::GetMimeType(
68 const std::string& path) const { 64 const std::string& path) const {
69 return "text/html"; 65 return "text/html";
70 } 66 }
71 67
72 } // namespace 68 } // namespace
73 69
74 //////////////////////////////////////////////////////////////////////////////// 70 ////////////////////////////////////////////////////////////////////////////////
75 // 71 //
76 // MediaInternalsUI 72 // MediaInternalsUI
77 // 73 //
78 //////////////////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////////////////
79 75
80 MediaInternalsUI::MediaInternalsUI(TabContents* contents) 76 MediaInternalsUI::MediaInternalsUI(TabContents* contents)
81 : ChromeWebUI(contents) { 77 : ChromeWebUI(contents) {
82 AddMessageHandler((new MediaInternalsMessageHandler())->Attach(this)); 78 AddMessageHandler((new MediaInternalsMessageHandler())->Attach(this));
83 79
84 contents->profile()->GetChromeURLDataManager()->AddDataSource( 80 contents->profile()->GetChromeURLDataManager()->AddDataSource(
85 new MediaInternalsHTMLSource()); 81 new MediaInternalsHTMLSource());
86 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history2_ui.cc ('k') | chrome/browser/ui/webui/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698