OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |