| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 void SimUnlockUIHTMLSource::StartDataRequest( | 269 void SimUnlockUIHTMLSource::StartDataRequest( |
| 270 const std::string& path, | 270 const std::string& path, |
| 271 int render_process_id, | 271 int render_process_id, |
| 272 int render_frame_id, | 272 int render_frame_id, |
| 273 const content::URLDataSource::GotDataCallback& callback) { | 273 const content::URLDataSource::GotDataCallback& callback) { |
| 274 base::DictionaryValue strings; | 274 base::DictionaryValue strings; |
| 275 strings.SetString("title", | 275 strings.SetString("title", |
| 276 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); | 276 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); |
| 277 strings.SetString("ok", l10n_util::GetStringUTF16(IDS_OK)); | 277 strings.SetString("ok", l10n_util::GetStringUTF16(IDS_OK)); |
| 278 strings.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 278 strings.SetString("enterPinTitle", | 279 strings.SetString("enterPinTitle", |
| 279 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); | 280 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); |
| 280 strings.SetString("enterPinMessage", | 281 strings.SetString("enterPinMessage", |
| 281 l10n_util::GetStringUTF16(IDS_SIM_ENTER_PIN_MESSAGE)); | 282 l10n_util::GetStringUTF16(IDS_SIM_ENTER_PIN_MESSAGE)); |
| 282 strings.SetString("enterPinTriesMessage", | 283 strings.SetString("enterPinTriesMessage", |
| 283 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TRIES_MESSAGE)); | 284 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TRIES_MESSAGE)); |
| 284 strings.SetString("incorrectPinTriesMessage", | 285 strings.SetString("incorrectPinTriesMessage", |
| 285 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_INCORRECT_PIN_TRIES_MESSAGE)); | 286 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_INCORRECT_PIN_TRIES_MESSAGE)); |
| 286 strings.SetString("incorrectPinTitle", | 287 strings.SetString("incorrectPinTitle", |
| 287 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_INCORRECT_PIN_TITLE)); | 288 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_INCORRECT_PIN_TITLE)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); | 323 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); |
| 323 strings.SetString("oldPin", l10n_util::GetStringUTF16( | 324 strings.SetString("oldPin", l10n_util::GetStringUTF16( |
| 324 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); | 325 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); |
| 325 | 326 |
| 326 webui::SetFontAndTextDirection(&strings); | 327 webui::SetFontAndTextDirection(&strings); |
| 327 | 328 |
| 328 static const base::StringPiece html( | 329 static const base::StringPiece html( |
| 329 ResourceBundle::GetSharedInstance().GetRawDataResource( | 330 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 330 IDR_SIM_UNLOCK_HTML)); | 331 IDR_SIM_UNLOCK_HTML)); |
| 331 | 332 |
| 333 webui::UseVersion2 version2; |
| 332 std::string full_html = webui::GetI18nTemplateHtml(html, &strings); | 334 std::string full_html = webui::GetI18nTemplateHtml(html, &strings); |
| 333 | 335 |
| 334 callback.Run(base::RefCountedString::TakeString(&full_html)); | 336 callback.Run(base::RefCountedString::TakeString(&full_html)); |
| 335 } | 337 } |
| 336 | 338 |
| 337 // SimUnlockHandler ------------------------------------------------------------ | 339 // SimUnlockHandler ------------------------------------------------------------ |
| 338 | 340 |
| 339 SimUnlockHandler::SimUnlockHandler() | 341 SimUnlockHandler::SimUnlockHandler() |
| 340 : state_(SIM_UNLOCK_LOADING), | 342 : state_(SIM_UNLOCK_LOADING), |
| 341 dialog_mode_(SimDialogDelegate::SIM_DIALOG_UNLOCK), | 343 dialog_mode_(SimDialogDelegate::SIM_DIALOG_UNLOCK), |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 SimUnlockHandler* handler = new SimUnlockHandler(); | 761 SimUnlockHandler* handler = new SimUnlockHandler(); |
| 760 web_ui->AddMessageHandler(handler); | 762 web_ui->AddMessageHandler(handler); |
| 761 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 763 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
| 762 | 764 |
| 763 // Set up the chrome://sim-unlock/ source. | 765 // Set up the chrome://sim-unlock/ source. |
| 764 Profile* profile = Profile::FromWebUI(web_ui); | 766 Profile* profile = Profile::FromWebUI(web_ui); |
| 765 content::URLDataSource::Add(profile, html_source); | 767 content::URLDataSource::Add(profile, html_source); |
| 766 } | 768 } |
| 767 | 769 |
| 768 } // namespace chromeos | 770 } // namespace chromeos |
| OLD | NEW |