| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 namespace chromeos { | 72 namespace chromeos { |
| 73 | 73 |
| 74 class SimUnlockUIHTMLSource : public content::URLDataSource { | 74 class SimUnlockUIHTMLSource : public content::URLDataSource { |
| 75 public: | 75 public: |
| 76 SimUnlockUIHTMLSource(); | 76 SimUnlockUIHTMLSource(); |
| 77 | 77 |
| 78 // content::URLDataSource implementation. | 78 // content::URLDataSource implementation. |
| 79 virtual std::string GetSource() const OVERRIDE; | 79 virtual std::string GetSource() const OVERRIDE; |
| 80 virtual void StartDataRequest( | 80 virtual void StartDataRequest( |
| 81 const std::string& path, | 81 const std::string& path, |
| 82 bool is_incognito, | 82 int render_process_id, |
| 83 int render_view_id, |
| 83 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 84 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 84 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 85 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
| 85 return "text/html"; | 86 return "text/html"; |
| 86 } | 87 } |
| 87 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 88 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 88 return false; | 89 return false; |
| 89 } | 90 } |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 virtual ~SimUnlockUIHTMLSource() {} | 93 virtual ~SimUnlockUIHTMLSource() {} |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 SimUnlockUIHTMLSource::SimUnlockUIHTMLSource() { | 254 SimUnlockUIHTMLSource::SimUnlockUIHTMLSource() { |
| 254 } | 255 } |
| 255 | 256 |
| 256 std::string SimUnlockUIHTMLSource::GetSource() const { | 257 std::string SimUnlockUIHTMLSource::GetSource() const { |
| 257 return chrome::kChromeUISimUnlockHost; | 258 return chrome::kChromeUISimUnlockHost; |
| 258 } | 259 } |
| 259 | 260 |
| 260 void SimUnlockUIHTMLSource::StartDataRequest( | 261 void SimUnlockUIHTMLSource::StartDataRequest( |
| 261 const std::string& path, | 262 const std::string& path, |
| 262 bool is_incognito, | 263 int render_process_id, |
| 264 int render_view_id, |
| 263 const content::URLDataSource::GotDataCallback& callback) { | 265 const content::URLDataSource::GotDataCallback& callback) { |
| 264 DictionaryValue strings; | 266 DictionaryValue strings; |
| 265 strings.SetString("title", | 267 strings.SetString("title", |
| 266 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); | 268 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); |
| 267 strings.SetString("ok", l10n_util::GetStringUTF16(IDS_OK)); | 269 strings.SetString("ok", l10n_util::GetStringUTF16(IDS_OK)); |
| 268 strings.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL)); | 270 strings.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 269 strings.SetString("enterPinTitle", | 271 strings.SetString("enterPinTitle", |
| 270 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); | 272 l10n_util::GetStringUTF16(IDS_SIM_UNLOCK_ENTER_PIN_TITLE)); |
| 271 strings.SetString("enterPinMessage", | 273 strings.SetString("enterPinMessage", |
| 272 l10n_util::GetStringUTF16(IDS_SIM_ENTER_PIN_MESSAGE)); | 274 l10n_util::GetStringUTF16(IDS_SIM_ENTER_PIN_MESSAGE)); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 SimUnlockHandler* handler = new SimUnlockHandler(); | 682 SimUnlockHandler* handler = new SimUnlockHandler(); |
| 681 web_ui->AddMessageHandler(handler); | 683 web_ui->AddMessageHandler(handler); |
| 682 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 684 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
| 683 | 685 |
| 684 // Set up the chrome://sim-unlock/ source. | 686 // Set up the chrome://sim-unlock/ source. |
| 685 Profile* profile = Profile::FromWebUI(web_ui); | 687 Profile* profile = Profile::FromWebUI(web_ui); |
| 686 content::URLDataSource::Add(profile, html_source); | 688 content::URLDataSource::Add(profile, html_source); |
| 687 } | 689 } |
| 688 | 690 |
| 689 } // namespace chromeos | 691 } // namespace chromeos |
| OLD | NEW |