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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 20 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
23 #include "chromeos/network/device_state.h" | 24 #include "chromeos/network/device_state.h" |
24 #include "chromeos/network/network_device_handler.h" | 25 #include "chromeos/network/network_device_handler.h" |
25 #include "chromeos/network/network_event_log.h" | 26 #include "chromeos/network/network_event_log.h" |
26 #include "chromeos/network/network_state_handler.h" | 27 #include "chromeos/network/network_state_handler.h" |
27 #include "chromeos/network/network_state_handler_observer.h" | 28 #include "chromeos/network/network_state_handler_observer.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 strings.SetString("simDisabledMessage", | 316 strings.SetString("simDisabledMessage", |
316 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_SIM_DISABLED_MESSAGE)); | 317 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_SIM_DISABLED_MESSAGE)); |
317 | 318 |
318 strings.SetString("changePinTitle", l10n_util::GetStringUTF16( | 319 strings.SetString("changePinTitle", l10n_util::GetStringUTF16( |
319 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_TITLE)); | 320 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_TITLE)); |
320 strings.SetString("changePinMessage", l10n_util::GetStringUTF16( | 321 strings.SetString("changePinMessage", l10n_util::GetStringUTF16( |
321 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); | 322 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_MESSAGE)); |
322 strings.SetString("oldPin", l10n_util::GetStringUTF16( | 323 strings.SetString("oldPin", l10n_util::GetStringUTF16( |
323 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); | 324 IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_OLD_PIN)); |
324 | 325 |
325 webui::SetFontAndTextDirection(&strings); | 326 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 327 webui::SetLoadTimeDataDefaults(app_locale, &strings); |
326 | 328 |
327 static const base::StringPiece html( | 329 static const base::StringPiece html( |
328 ResourceBundle::GetSharedInstance().GetRawDataResource( | 330 ResourceBundle::GetSharedInstance().GetRawDataResource( |
329 IDR_SIM_UNLOCK_HTML)); | 331 IDR_SIM_UNLOCK_HTML)); |
330 | 332 |
331 std::string full_html = webui::GetI18nTemplateHtml(html, &strings); | 333 std::string full_html = webui::GetI18nTemplateHtml(html, &strings); |
332 callback.Run(base::RefCountedString::TakeString(&full_html)); | 334 callback.Run(base::RefCountedString::TakeString(&full_html)); |
333 } | 335 } |
334 | 336 |
335 // SimUnlockHandler ------------------------------------------------------------ | 337 // SimUnlockHandler ------------------------------------------------------------ |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 SimUnlockHandler* handler = new SimUnlockHandler(); | 759 SimUnlockHandler* handler = new SimUnlockHandler(); |
758 web_ui->AddMessageHandler(handler); | 760 web_ui->AddMessageHandler(handler); |
759 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 761 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
760 | 762 |
761 // Set up the chrome://sim-unlock/ source. | 763 // Set up the chrome://sim-unlock/ source. |
762 Profile* profile = Profile::FromWebUI(web_ui); | 764 Profile* profile = Profile::FromWebUI(web_ui); |
763 content::URLDataSource::Add(profile, html_source); | 765 content::URLDataSource::Add(profile, html_source); |
764 } | 766 } |
765 | 767 |
766 } // namespace chromeos | 768 } // namespace chromeos |
OLD | NEW |