| 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" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 #if defined(OS_CHROMEOS) | 212 #if defined(OS_CHROMEOS) |
| 213 web_ui_->RegisterMessageCallback(kJsCallbackGetRegistrationUrl, | 213 web_ui_->RegisterMessageCallback(kJsCallbackGetRegistrationUrl, |
| 214 NewCallback(this, &RegisterPageHandler::HandleGetRegistrationUrl)); | 214 NewCallback(this, &RegisterPageHandler::HandleGetRegistrationUrl)); |
| 215 web_ui_->RegisterMessageCallback(kJsCallbackUserInfo, | 215 web_ui_->RegisterMessageCallback(kJsCallbackUserInfo, |
| 216 NewCallback(this, &RegisterPageHandler::HandleGetUserInfo)); | 216 NewCallback(this, &RegisterPageHandler::HandleGetUserInfo)); |
| 217 #endif | 217 #endif |
| 218 } | 218 } |
| 219 | 219 |
| 220 void RegisterPageHandler::HandleGetRegistrationUrl(const ListValue* args) { | 220 void RegisterPageHandler::HandleGetRegistrationUrl(const ListValue* args) { |
| 221 #if defined(OS_CHROMEOS) | 221 #if defined(OS_CHROMEOS) |
| 222 chromeos::StartupCustomizationDocument* customization = |
| 223 chromeos::StartupCustomizationDocument::GetInstance(); |
| 222 if (WizardController::default_controller() && | 224 if (WizardController::default_controller() && |
| 223 WizardController::default_controller()->GetCustomization()) { | 225 customization->IsReady()) { |
| 224 const std::string& url = WizardController::default_controller()-> | 226 const std::string& url = customization->registration_url(); |
| 225 GetCustomization()->registration_url(); | |
| 226 VLOG(1) << "Loading registration form with URL: " << url; | 227 VLOG(1) << "Loading registration form with URL: " << url; |
| 227 GURL register_url(url); | 228 GURL register_url(url); |
| 228 if (!register_url.is_valid()) { | 229 if (!register_url.is_valid()) { |
| 229 SkipRegistration("Registration URL defined in manifest is invalid."); | 230 SkipRegistration("Registration URL defined in manifest is invalid."); |
| 230 return; | 231 return; |
| 231 } | 232 } |
| 232 StringValue url_value(url); | 233 StringValue url_value(url); |
| 233 web_ui_->CallJavascriptFunction(kJsApiSetRegistrationUrl, url_value); | 234 web_ui_->CallJavascriptFunction(kJsApiSetRegistrationUrl, url_value); |
| 234 } else { | 235 } else { |
| 235 SkipRegistration("Startup manifest not defined."); | 236 SkipRegistration("Startup manifest not defined."); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 309 |
| 309 RegisterPageUI::RegisterPageUI(TabContents* contents) : WebUI(contents){ | 310 RegisterPageUI::RegisterPageUI(TabContents* contents) : WebUI(contents){ |
| 310 RegisterPageHandler* handler = new RegisterPageHandler(); | 311 RegisterPageHandler* handler = new RegisterPageHandler(); |
| 311 AddMessageHandler((handler)->Attach(this)); | 312 AddMessageHandler((handler)->Attach(this)); |
| 312 handler->Init(); | 313 handler->Init(); |
| 313 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 314 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
| 314 | 315 |
| 315 // Set up the chrome://register/ source. | 316 // Set up the chrome://register/ source. |
| 316 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 317 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 317 } | 318 } |
| OLD | NEW |