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

Side by Side Diff: chrome/browser/ui/webui/chromeos/choose_mobile_network_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/choose_mobile_network_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 l10n_util::GetStringUTF16(IDS_NETWORK_NO_MOBILE_NETWORKS)); 115 l10n_util::GetStringUTF16(IDS_NETWORK_NO_MOBILE_NETWORKS));
116 strings.SetString("connect", 116 strings.SetString("connect",
117 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT)); 117 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT));
118 strings.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL)); 118 strings.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL));
119 SetFontAndTextDirection(&strings); 119 SetFontAndTextDirection(&strings);
120 120
121 static const base::StringPiece html( 121 static const base::StringPiece html(
122 ResourceBundle::GetSharedInstance().GetRawDataResource( 122 ResourceBundle::GetSharedInstance().GetRawDataResource(
123 IDR_CHOOSE_MOBILE_NETWORK_HTML)); 123 IDR_CHOOSE_MOBILE_NETWORK_HTML));
124 124
125 const std::string& full_html = jstemplate_builder::GetI18nTemplateHtml( 125 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html,
126 html, &strings); 126 &strings);
127 127
128 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes()); 128 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
129 html_bytes->data.resize(full_html.size());
130 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
131
132 SendResponse(request_id, html_bytes);
133 } 129 }
134 130
135 // ChooseMobileNetworkHandler implementation. 131 // ChooseMobileNetworkHandler implementation.
136 132
137 ChooseMobileNetworkHandler::ChooseMobileNetworkHandler() 133 ChooseMobileNetworkHandler::ChooseMobileNetworkHandler()
138 : is_page_ready_(false), has_pending_results_(false) { 134 : is_page_ready_(false), has_pending_results_(false) {
139 if (!CrosLibrary::Get()->EnsureLoaded()) 135 if (!CrosLibrary::Get()->EnsureLoaded())
140 return; 136 return;
141 137
142 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 138 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 : ChromeWebUI(contents) { 249 : ChromeWebUI(contents) {
254 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); 250 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler();
255 AddMessageHandler((handler)->Attach(this)); 251 AddMessageHandler((handler)->Attach(this));
256 ChooseMobileNetworkHTMLSource* html_source = 252 ChooseMobileNetworkHTMLSource* html_source =
257 new ChooseMobileNetworkHTMLSource(); 253 new ChooseMobileNetworkHTMLSource();
258 // Set up the "chrome://choose-mobile-network" source. 254 // Set up the "chrome://choose-mobile-network" source.
259 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 255 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
260 } 256 }
261 257
262 } // namespace chromeos 258 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_data_source.cc ('k') | chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698