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

Side by Side Diff: chrome/browser/ui/webui/chromeos/imageburner/imageburner_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
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/chromeos/imageburner/imageburner_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h"
6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h" 6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h"
7 7
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 localized_strings.SetString("retryButton", 109 localized_strings.SetString("retryButton",
110 l10n_util::GetStringUTF16(IDS_IMAGEBURN_RETRY_BUTTON)); 110 l10n_util::GetStringUTF16(IDS_IMAGEBURN_RETRY_BUTTON));
111 111
112 localized_strings.SetString("moreInfoLink", kMoreInfoLink); 112 localized_strings.SetString("moreInfoLink", kMoreInfoLink);
113 113
114 SetFontAndTextDirection(&localized_strings); 114 SetFontAndTextDirection(&localized_strings);
115 115
116 static const base::StringPiece imageburn_html( 116 static const base::StringPiece imageburn_html(
117 ResourceBundle::GetSharedInstance().GetRawDataResource( 117 ResourceBundle::GetSharedInstance().GetRawDataResource(
118 IDR_IMAGEBURNER_HTML)); 118 IDR_IMAGEBURNER_HTML));
119 const std::string full_html = jstemplate_builder::GetTemplatesHtml( 119 std::string full_html = jstemplate_builder::GetTemplatesHtml(
120 imageburn_html, &localized_strings, "more-info-link"); 120 imageburn_html, &localized_strings, "more-info-link");
121 121
122 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 122 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
123 html_bytes->data.resize(full_html.size());
124 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
125
126 SendResponse(request_id, html_bytes);
127 } 123 }
128 124
129 virtual std::string GetMimeType(const std::string&) const { 125 virtual std::string GetMimeType(const std::string&) const {
130 return "text/html"; 126 return "text/html";
131 } 127 }
132 128
133 private: 129 private:
134 virtual ~UIHTMLSource() {} 130 virtual ~UIHTMLSource() {}
135 131
136 DISALLOW_COPY_AND_ASSIGN(UIHTMLSource); 132 DISALLOW_COPY_AND_ASSIGN(UIHTMLSource);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // ImageBurnUI 663 // ImageBurnUI
668 // 664 //
669 //////////////////////////////////////////////////////////////////////////////// 665 ////////////////////////////////////////////////////////////////////////////////
670 666
671 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { 667 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) {
672 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); 668 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents);
673 AddMessageHandler((handler)->Attach(this)); 669 AddMessageHandler((handler)->Attach(this));
674 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource(); 670 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource();
675 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 671 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
676 } 672 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc ('k') | chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698