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

Side by Side Diff: chrome/browser/ui/webui/chromeos/sim_unlock_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/sim_unlock_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/sim_unlock_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); 288 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE));
289 strings.SetString("oldPin", l10n_util::GetStringUTF16( 289 strings.SetString("oldPin", l10n_util::GetStringUTF16(
290 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); 290 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN));
291 291
292 SetFontAndTextDirection(&strings); 292 SetFontAndTextDirection(&strings);
293 293
294 static const base::StringPiece html( 294 static const base::StringPiece html(
295 ResourceBundle::GetSharedInstance().GetRawDataResource( 295 ResourceBundle::GetSharedInstance().GetRawDataResource(
296 IDR_SIM_UNLOCK_HTML)); 296 IDR_SIM_UNLOCK_HTML));
297 297
298 const std::string& full_html = jstemplate_builder::GetI18nTemplateHtml( 298 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html,
299 html, &strings); 299 &strings);
300 300
301 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes()); 301 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
302 html_bytes->data.resize(full_html.size());
303 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
304
305 SendResponse(request_id, html_bytes);
306 } 302 }
307 303
308 // SimUnlockHandler ------------------------------------------------------------ 304 // SimUnlockHandler ------------------------------------------------------------
309 305
310 SimUnlockHandler::SimUnlockHandler() 306 SimUnlockHandler::SimUnlockHandler()
311 : tab_contents_(NULL), 307 : tab_contents_(NULL),
312 state_(SIM_UNLOCK_LOADING), 308 state_(SIM_UNLOCK_LOADING),
313 dialog_mode_(SimDialogDelegate::SIM_DIALOG_UNLOCK) { 309 dialog_mode_(SimDialogDelegate::SIM_DIALOG_UNLOCK) {
314 const chromeos::NetworkDevice* cellular = GetCellularDevice(); 310 const chromeos::NetworkDevice* cellular = GetCellularDevice();
315 // One could just call us directly via chrome://sim-unlock. 311 // One could just call us directly via chrome://sim-unlock.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 SimUnlockHandler* handler = new SimUnlockHandler(); 653 SimUnlockHandler* handler = new SimUnlockHandler();
658 AddMessageHandler((handler)->Attach(this)); 654 AddMessageHandler((handler)->Attach(this));
659 handler->Init(contents); 655 handler->Init(contents);
660 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); 656 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource();
661 657
662 // Set up the chrome://sim-unlock/ source. 658 // Set up the chrome://sim-unlock/ source.
663 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 659 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
664 } 660 }
665 661
666 } // namespace chromeos 662 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/register_page_ui.cc ('k') | chrome/browser/ui/webui/chromeos/system_info_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698