Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1861)

Unified Diff: chrome/browser/dom_ui/register_page_ui.cc

Issue 3026007: Revert 52902 - Add getUserInfo, getRegistrationUrl message callback for regis... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/resources/host_registration_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/register_page_ui.cc
===================================================================
--- chrome/browser/dom_ui/register_page_ui.cc (revision 52903)
+++ chrome/browser/dom_ui/register_page_ui.cc (working copy)
@@ -1,35 +1,20 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/dom_ui/register_page_ui.h"
-#include <string>
-
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/callback.h"
-#include "base/logging.h"
#include "base/string_piece.h"
-#include "base/utf_string_conversions.h"
-#include "base/values.h"
#include "base/weak_ptr.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/customization_document.h"
-#include "chrome/browser/chromeos/login/wizard_controller.h"
-#include "chrome/browser/chromeos/version_loader.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
-namespace {
-// Constant value for os_name sent in setUserInfo.
-const wchar_t kOSName[] = L"ChromeOS";
-} // namespace
-
class RegisterPageUIHTMLSource : public ChromeURLDataManager::DataSource {
public:
RegisterPageUIHTMLSource();
@@ -64,23 +49,6 @@
virtual void RegisterMessages();
private:
- // Handlers for JS DOMUI messages.
- void HandleGetRegistrationUrl(const Value* value);
- void HandleGetUserInfo(const Value* value);
-
- // Callback from chromeos::VersionLoader giving the version.
- void OnVersion(chromeos::VersionLoader::Handle handle, std::string version);
-
- // Sends message to host registration page with system/user info data.
- void SendUserInfo();
-
- // Handles asynchronously loading the version.
- chromeos::VersionLoader version_loader_;
- // Used to request the version.
- CancelableRequestConsumer version_consumer_;
-
- std::string version_;
-
DISALLOW_COPY_AND_ASSIGN(RegisterPageHandler);
};
@@ -97,15 +65,6 @@
void RegisterPageUIHTMLSource::StartDataRequest(const std::string& path,
bool is_off_the_record,
int request_id) {
- // Make sure that chrome://register is available only during
- // OOBE wizard lifetime.
- if (!WizardController::default_controller() &&
- !WizardController::default_controller()->is_oobe()) {
- scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes);
- SendResponse(request_id, empty_bytes);
- return;
- }
-
static const base::StringPiece register_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_HOST_REGISTRATION_PAGE_HTML));
@@ -141,71 +100,9 @@
}
void RegisterPageHandler::RegisterMessages() {
- dom_ui_->RegisterMessageCallback("getRegistrationUrl",
- NewCallback(this, &RegisterPageHandler::HandleGetRegistrationUrl));
- dom_ui_->RegisterMessageCallback("getUserInfo",
- NewCallback(this, &RegisterPageHandler::HandleGetUserInfo));
+ // TODO(nkostylev): Register callback messages.
}
-void RegisterPageHandler::HandleGetRegistrationUrl(const Value* value) {
- if (WizardController::default_controller() &&
- WizardController::default_controller()->GetCustomization()) {
- StringValue url_value(WizardController::default_controller()->
- GetCustomization()->registration_url());
- dom_ui_->CallJavascriptFunction(L"setRegistrationUrl", url_value);
- } else {
- LOG(ERROR) << "Startup manifest not defined.";
- }
-}
-
-void RegisterPageHandler::HandleGetUserInfo(const Value* value) {
- if (chromeos::CrosLibrary::Get()->EnsureLoaded()) {
- version_loader_.GetVersion(
- &version_consumer_, NewCallback(this,
- &RegisterPageHandler::OnVersion));
- } else {
- LOG(ERROR) << "Error loading cros library.";
- }
-}
-
-void RegisterPageHandler::OnVersion(chromeos::VersionLoader::Handle handle,
- std::string version) {
- version_ = version;
- SendUserInfo();
-}
-
-void RegisterPageHandler::SendUserInfo() {
- DictionaryValue value;
- // TODO(nkostylev): Extract all available system/user info.
- // http://crosbug.com/4813
-
- std::string system_sku;
- if (WizardController::default_controller() &&
- WizardController::default_controller()->GetCustomization()) {
- system_sku = WizardController::default_controller()->
- GetCustomization()->product_sku();
- } else {
- LOG(ERROR) << "Startup manifest not defined.";
- }
-
- // Required info.
- value.SetString(L"system_hwqual", L"hardware qual identifier");
- value.SetString(L"system_sku", UTF8ToWide(system_sku));
- value.SetString(L"system_serial", L"serial number");
- value.SetString(L"os_language",
- UTF8ToWide(g_browser_process->GetApplicationLocale()));
- value.SetString(L"os_name", kOSName);
- value.SetString(L"os_version", UTF8ToWide(version_));
- value.SetString(L"os_connection", L"connection type");
- value.SetString(L"user_email", L"");
-
- // Optional info.
- value.SetString(L"user_first_name", L"");
- value.SetString(L"user_last_name", L"");
-
- dom_ui_->CallJavascriptFunction(L"setUserInfo", value);
-}
-
////////////////////////////////////////////////////////////////////////////////
//
// RegisterPageUI
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/resources/host_registration_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698