| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mobile_setup_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 strings.SetString("completed_text", | 423 strings.SetString("completed_text", |
| 424 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_TEXT)); | 424 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_TEXT)); |
| 425 strings.SetString("close_button", | 425 strings.SetString("close_button", |
| 426 l10n_util::GetStringUTF16(IDS_CLOSE)); | 426 l10n_util::GetStringUTF16(IDS_CLOSE)); |
| 427 SetFontAndTextDirection(&strings); | 427 SetFontAndTextDirection(&strings); |
| 428 | 428 |
| 429 static const base::StringPiece html( | 429 static const base::StringPiece html( |
| 430 ResourceBundle::GetSharedInstance().GetRawDataResource( | 430 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 431 IDR_MOBILE_SETUP_PAGE_HTML)); | 431 IDR_MOBILE_SETUP_PAGE_HTML)); |
| 432 | 432 |
| 433 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 433 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html, |
| 434 html, &strings); | 434 &strings); |
| 435 | 435 |
| 436 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 436 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
| 437 html_bytes->data.resize(full_html.size()); | |
| 438 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | |
| 439 | |
| 440 SendResponse(request_id, html_bytes); | |
| 441 } | 437 } |
| 442 | 438 |
| 443 //////////////////////////////////////////////////////////////////////////////// | 439 //////////////////////////////////////////////////////////////////////////////// |
| 444 // | 440 // |
| 445 // MobileSetupHandler | 441 // MobileSetupHandler |
| 446 // | 442 // |
| 447 //////////////////////////////////////////////////////////////////////////////// | 443 //////////////////////////////////////////////////////////////////////////////// |
| 448 MobileSetupHandler::MobileSetupHandler(const std::string& service_path) | 444 MobileSetupHandler::MobileSetupHandler(const std::string& service_path) |
| 449 : tab_contents_(NULL), | 445 : tab_contents_(NULL), |
| 450 state_(PLAN_ACTIVATION_PAGE_LOADING), | 446 state_(PLAN_ACTIVATION_PAGE_LOADING), |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 std::string service_path = network ? network->service_path() : std::string(); | 1324 std::string service_path = network ? network->service_path() : std::string(); |
| 1329 MobileSetupHandler* handler = new MobileSetupHandler(service_path); | 1325 MobileSetupHandler* handler = new MobileSetupHandler(service_path); |
| 1330 AddMessageHandler((handler)->Attach(this)); | 1326 AddMessageHandler((handler)->Attach(this)); |
| 1331 handler->Init(contents); | 1327 handler->Init(contents); |
| 1332 MobileSetupUIHTMLSource* html_source = | 1328 MobileSetupUIHTMLSource* html_source = |
| 1333 new MobileSetupUIHTMLSource(service_path); | 1329 new MobileSetupUIHTMLSource(service_path); |
| 1334 | 1330 |
| 1335 // Set up the chrome://mobilesetup/ source. | 1331 // Set up the chrome://mobilesetup/ source. |
| 1336 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 1332 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1337 } | 1333 } |
| OLD | NEW |