| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/common/jstemplate_builder.h" | 23 #include "chrome/common/jstemplate_builder.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
| 29 #include "content/public/browser/web_ui_message_handler.h" | 29 #include "content/public/browser/web_ui_message_handler.h" |
| 30 #include "grit/browser_resources.h" | 30 #include "grit/browser_resources.h" |
| 31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/base/layout.h" |
| 33 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
| 34 | 35 |
| 35 using content::BrowserThread; | 36 using content::BrowserThread; |
| 36 using content::WebContents; | 37 using content::WebContents; |
| 37 using content::WebUIMessageHandler; | 38 using content::WebUIMessageHandler; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 // JS API callbacks names. | 42 // JS API callbacks names. |
| 42 const char kJsApiCancel[] = "cancel"; | 43 const char kJsApiCancel[] = "cancel"; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_TITLE)); | 299 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_TITLE)); |
| 299 strings.SetString("changePinMessage", l10n_util::GetStringUTF16( | 300 strings.SetString("changePinMessage", l10n_util::GetStringUTF16( |
| 300 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); | 301 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); |
| 301 strings.SetString("oldPin", l10n_util::GetStringUTF16( | 302 strings.SetString("oldPin", l10n_util::GetStringUTF16( |
| 302 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); | 303 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); |
| 303 | 304 |
| 304 SetFontAndTextDirection(&strings); | 305 SetFontAndTextDirection(&strings); |
| 305 | 306 |
| 306 static const base::StringPiece html( | 307 static const base::StringPiece html( |
| 307 ResourceBundle::GetSharedInstance().GetRawDataResource( | 308 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 308 IDR_SIM_UNLOCK_HTML)); | 309 IDR_SIM_UNLOCK_HTML, ui::SCALE_FACTOR_NONE)); |
| 309 | 310 |
| 310 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html, | 311 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html, |
| 311 &strings); | 312 &strings); |
| 312 | 313 |
| 313 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); | 314 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
| 314 } | 315 } |
| 315 | 316 |
| 316 // SimUnlockHandler ------------------------------------------------------------ | 317 // SimUnlockHandler ------------------------------------------------------------ |
| 317 | 318 |
| 318 SimUnlockHandler::SimUnlockHandler() | 319 SimUnlockHandler::SimUnlockHandler() |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 SimUnlockHandler* handler = new SimUnlockHandler(); | 669 SimUnlockHandler* handler = new SimUnlockHandler(); |
| 669 web_ui->AddMessageHandler(handler); | 670 web_ui->AddMessageHandler(handler); |
| 670 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 671 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
| 671 | 672 |
| 672 // Set up the chrome://sim-unlock/ source. | 673 // Set up the chrome://sim-unlock/ source. |
| 673 Profile* profile = Profile::FromWebUI(web_ui); | 674 Profile* profile = Profile::FromWebUI(web_ui); |
| 674 ChromeURLDataManager::AddDataSource(profile, html_source); | 675 ChromeURLDataManager::AddDataSource(profile, html_source); |
| 675 } | 676 } |
| 676 | 677 |
| 677 } // namespace chromeos | 678 } // namespace chromeos |
| OLD | NEW |