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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 void SimUnlockHandler::UpdatePage(const DeviceState* cellular, | 748 void SimUnlockHandler::UpdatePage(const DeviceState* cellular, |
749 const std::string& error_msg) { | 749 const std::string& error_msg) { |
750 base::DictionaryValue sim_dict; | 750 base::DictionaryValue sim_dict; |
751 if (cellular) | 751 if (cellular) |
752 sim_dict.SetInteger(kTriesLeft, cellular->sim_retries_left()); | 752 sim_dict.SetInteger(kTriesLeft, cellular->sim_retries_left()); |
753 sim_dict.SetInteger(kState, state_); | 753 sim_dict.SetInteger(kState, state_); |
754 if (!error_msg.empty()) | 754 if (!error_msg.empty()) |
755 sim_dict.SetString(kError, error_msg); | 755 sim_dict.SetString(kError, error_msg); |
756 else | 756 else |
757 sim_dict.SetString(kError, kErrorOk); | 757 sim_dict.SetString(kError, kErrorOk); |
758 web_ui()->CallJavascriptFunction(kJsApiSimStatusChanged, sim_dict); | 758 web_ui()->CallJavascriptFunctionUnsafe(kJsApiSimStatusChanged, sim_dict); |
759 } | 759 } |
760 | 760 |
761 // SimUnlockUI ----------------------------------------------------------------- | 761 // SimUnlockUI ----------------------------------------------------------------- |
762 | 762 |
763 SimUnlockUI::SimUnlockUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 763 SimUnlockUI::SimUnlockUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
764 SimUnlockHandler* handler = new SimUnlockHandler(); | 764 SimUnlockHandler* handler = new SimUnlockHandler(); |
765 web_ui->AddMessageHandler(handler); | 765 web_ui->AddMessageHandler(handler); |
766 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 766 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
767 | 767 |
768 // Set up the chrome://sim-unlock/ source. | 768 // Set up the chrome://sim-unlock/ source. |
769 Profile* profile = Profile::FromWebUI(web_ui); | 769 Profile* profile = Profile::FromWebUI(web_ui); |
770 content::URLDataSource::Add(profile, html_source); | 770 content::URLDataSource::Add(profile, html_source); |
771 } | 771 } |
772 | 772 |
773 } // namespace chromeos | 773 } // namespace chromeos |
OLD | NEW |