| 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/register_page_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/register_page_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/chromeos/customization_document.h" | 18 #include "chrome/browser/chromeos/customization_document.h" |
| 19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 20 #include "chrome/browser/chromeos/system_access.h" | 20 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 21 #include "chrome/browser/chromeos/version_loader.h" | 21 #include "chrome/browser/chromeos/version_loader.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 23 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/browser/browser_thread.h" | 25 #include "content/browser/browser_thread.h" |
| 26 #include "content/browser/tab_contents/tab_contents.h" | 26 #include "content/browser/tab_contents/tab_contents.h" |
| 27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 28 #include "grit/browser_resources.h" | 28 #include "grit/browser_resources.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 | 30 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 chromeos::WizardController::default_controller()->SkipRegistration(); | 267 chromeos::WizardController::default_controller()->SkipRegistration(); |
| 268 else | 268 else |
| 269 web_ui_->CallJavascriptFunction(kJsApiSkipRegistration); | 269 web_ui_->CallJavascriptFunction(kJsApiSkipRegistration); |
| 270 #endif | 270 #endif |
| 271 } | 271 } |
| 272 | 272 |
| 273 void RegisterPageHandler::SendUserInfo() { | 273 void RegisterPageHandler::SendUserInfo() { |
| 274 #if defined(OS_CHROMEOS) | 274 #if defined(OS_CHROMEOS) |
| 275 DictionaryValue value; | 275 DictionaryValue value; |
| 276 | 276 |
| 277 chromeos::SystemAccess * sys_lib = | 277 chromeos::system::StatisticsProvider * provider = |
| 278 chromeos::SystemAccess::GetInstance(); | 278 chromeos::system::StatisticsProvider::GetInstance(); |
| 279 | 279 |
| 280 // Required info. | 280 // Required info. |
| 281 std::string system_hwqual; | 281 std::string system_hwqual; |
| 282 std::string serial_number; | 282 std::string serial_number; |
| 283 if (!sys_lib->GetMachineStatistic(kMachineInfoSystemHwqual, &system_hwqual) || | 283 if (!provider->GetMachineStatistic(kMachineInfoSystemHwqual, |
| 284 !sys_lib->GetMachineStatistic(kMachineInfoSerialNumber, &serial_number)) { | 284 &system_hwqual) || |
| 285 !provider->GetMachineStatistic(kMachineInfoSerialNumber, |
| 286 &serial_number)) { |
| 285 SkipRegistration("Failed to get required machine info."); | 287 SkipRegistration("Failed to get required machine info."); |
| 286 return; | 288 return; |
| 287 } | 289 } |
| 288 value.SetString("system_hwqual", system_hwqual); | 290 value.SetString("system_hwqual", system_hwqual); |
| 289 value.SetString("system_serial", serial_number); | 291 value.SetString("system_serial", serial_number); |
| 290 value.SetString("os_language", g_browser_process->GetApplicationLocale()); | 292 value.SetString("os_language", g_browser_process->GetApplicationLocale()); |
| 291 value.SetString("os_name", kOSName); | 293 value.SetString("os_name", kOSName); |
| 292 value.SetString("os_version", version_); | 294 value.SetString("os_version", version_); |
| 293 value.SetString("os_connection", GetConnectionType()); | 295 value.SetString("os_connection", GetConnectionType()); |
| 294 value.SetString("user_email", ""); | 296 value.SetString("user_email", ""); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 309 | 311 |
| 310 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { | 312 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { |
| 311 RegisterPageHandler* handler = new RegisterPageHandler(); | 313 RegisterPageHandler* handler = new RegisterPageHandler(); |
| 312 AddMessageHandler((handler)->Attach(this)); | 314 AddMessageHandler((handler)->Attach(this)); |
| 313 handler->Init(); | 315 handler->Init(); |
| 314 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 316 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
| 315 | 317 |
| 316 // Set up the chrome://register/ source. | 318 // Set up the chrome://register/ source. |
| 317 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 319 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 318 } | 320 } |
| OLD | NEW |