| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback.h" | |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 13 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 14 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 15 #include "base/values.h" |
| 17 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 19 #include "chrome/browser/chromeos/cros/network_library.h" | 18 #include "chrome/browser/chromeos/cros/network_library.h" |
| 20 #include "chrome/browser/chromeos/customization_document.h" | 19 #include "chrome/browser/chromeos/customization_document.h" |
| 21 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 SkipRegistration("Startup manifest not defined."); | 233 SkipRegistration("Startup manifest not defined."); |
| 235 } | 234 } |
| 236 #endif | 235 #endif |
| 237 } | 236 } |
| 238 | 237 |
| 239 void RegisterPageHandler::HandleGetUserInfo(const ListValue* args) { | 238 void RegisterPageHandler::HandleGetUserInfo(const ListValue* args) { |
| 240 #if defined(OS_CHROMEOS) | 239 #if defined(OS_CHROMEOS) |
| 241 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | 240 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 242 version_loader_.GetVersion( | 241 version_loader_.GetVersion( |
| 243 &version_consumer_, | 242 &version_consumer_, |
| 244 NewCallback(this, | 243 base::Bind(&RegisterPageHandler::OnVersion, base::Unretained(this)), |
| 245 &RegisterPageHandler::OnVersion), | |
| 246 chromeos::VersionLoader::VERSION_FULL); | 244 chromeos::VersionLoader::VERSION_FULL); |
| 247 } else { | 245 } else { |
| 248 SkipRegistration("CrosLibrary is not loaded."); | 246 SkipRegistration("CrosLibrary is not loaded."); |
| 249 } | 247 } |
| 250 #endif | 248 #endif |
| 251 } | 249 } |
| 252 | 250 |
| 253 #if defined(OS_CHROMEOS) | 251 #if defined(OS_CHROMEOS) |
| 254 void RegisterPageHandler::OnVersion(chromeos::VersionLoader::Handle handle, | 252 void RegisterPageHandler::OnVersion(chromeos::VersionLoader::Handle handle, |
| 255 std::string version) { | 253 std::string version) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { | 308 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { |
| 311 RegisterPageHandler* handler = new RegisterPageHandler(); | 309 RegisterPageHandler* handler = new RegisterPageHandler(); |
| 312 AddMessageHandler((handler)->Attach(this)); | 310 AddMessageHandler((handler)->Attach(this)); |
| 313 handler->Init(); | 311 handler->Init(); |
| 314 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 312 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
| 315 | 313 |
| 316 // Set up the chrome://register/ source. | 314 // Set up the chrome://register/ source. |
| 317 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 315 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 318 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 316 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 319 } | 317 } |
| OLD | NEW |