summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 06:54:33 +0000
committerdpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 06:54:33 +0000
commit9ef8683203cf6238b915a54657acfa6bdf8feeab (patch)
tree74491c5389e3b6d8410c5d358377452180b13627
parent2382a3be1239e3a06f0d23c38d54c861d5ce6163 (diff)
downloadchromium_src-9ef8683203cf6238b915a54657acfa6bdf8feeab.zip
chromium_src-9ef8683203cf6238b915a54657acfa6bdf8feeab.tar.gz
chromium_src-9ef8683203cf6238b915a54657acfa6bdf8feeab.tar.bz2
Make customization documents singletons.
BUG=chromium-os:13019 TEST=existing browser tests Review URL: http://codereview.chromium.org/6893052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83304 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/customization_document.cc176
-rw-r--r--chrome/browser/chromeos/customization_document.h101
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc22
-rw-r--r--chrome/browser/chromeos/login/apply_services_customization.cc174
-rw-r--r--chrome/browser/chromeos/login/apply_services_customization.h81
-rw-r--r--chrome/browser/chromeos/login/base_login_display_host.cc17
-rw-r--r--chrome/browser/chromeos/login/base_login_display_host.h1
-rw-r--r--chrome/browser/chromeos/login/eula_view.cc4
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc18
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h7
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller_browsertest.cc4
-rw-r--r--chrome/browser/chromeos/login/helper.cc27
-rw-r--r--chrome/browser/chromeos/login/helper.h5
-rw-r--r--chrome/browser/chromeos/login/login_display_host.h1
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc38
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.h12
-rw-r--r--chrome/browser/prefs/browser_prefs.cc4
-rw-r--r--chrome/browser/ui/webui/chromeos/register_page_ui.cc7
-rw-r--r--chrome/chrome_browser.gypi2
19 files changed, 291 insertions, 410 deletions
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index 33950b3..35938c8 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -4,12 +4,19 @@
#include "chrome/browser/chromeos/customization_document.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/system_access.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "content/browser/browser_thread.h"
// Manifest attributes names.
@@ -34,11 +41,32 @@ const char kAcceptedManifestVersion[] = "1.0";
const char kHwid[] = "hwid";
+// Path to OEM partner startup customization manifest.
+const char kStartupCustomizationManifestPath[] =
+ "/opt/oem/etc/startup_manifest.json";
+
+// URL where to fetch OEM services customization manifest from.
+const char kServicesCustomizationManifestUrl[] =
+ "file:///opt/oem/etc/services_manifest.json";
+
+// Name of local state option that tracks if services customization has been
+// applied.
+const char kServicesCustomizationAppliedPref[] = "ServicesCustomizationApplied";
+
+// Maximum number of retries to fetch file if network is not available.
+const int kMaxFetchRetries = 3;
+
+// Delay between file fetch retries if network is not available.
+const int kRetriesDelayInSec = 2;
+
} // anonymous namespace
+DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::ServicesCustomizationDocument);
+
namespace chromeos {
-// CustomizationDocument implementation.
+// CustomizationDocument implementation. ---------------------------------------
+
bool CustomizationDocument::LoadManifestFromFile(
const FilePath& manifest_path) {
std::string manifest;
@@ -72,7 +100,8 @@ std::string CustomizationDocument::GetLocaleSpecificString(
const std::string& dictionary_name,
const std::string& entry_name) const {
DictionaryValue* dictionary_content = NULL;
- if (!root_->GetDictionary(dictionary_name, &dictionary_content))
+ if (!root_.get() ||
+ !root_->GetDictionary(dictionary_name, &dictionary_content))
return std::string();
DictionaryValue* locale_dictionary = NULL;
@@ -92,19 +121,32 @@ std::string CustomizationDocument::GetLocaleSpecificString(
return std::string();
}
-// StartupCustomizationDocument implementation.
+// StartupCustomizationDocument implementation. --------------------------------
+
+StartupCustomizationDocument::StartupCustomizationDocument() {
+ {
+ // Loading manifest causes us to do blocking IO on UI thread.
+ // Temporarily allow it until we fix http://crosbug.com/11103
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ LoadManifestFromFile(FilePath(kStartupCustomizationManifestPath));
+ }
+ Init(SystemAccess::GetInstance());
+}
+
StartupCustomizationDocument::StartupCustomizationDocument(
- SystemAccess* system_access)
- : system_access_(system_access) {
+ SystemAccess* system_access, const std::string& manifest) {
+ LoadManifestFromString(manifest);
+ Init(system_access);
}
-bool StartupCustomizationDocument::LoadManifestFromString(
- const std::string& manifest) {
- DCHECK(system_access_);
+StartupCustomizationDocument* StartupCustomizationDocument::GetInstance() {
+ return Singleton<StartupCustomizationDocument,
+ DefaultSingletonTraits<StartupCustomizationDocument> >::get();
+}
- if (!CustomizationDocument::LoadManifestFromString(manifest)) {
- return false;
- }
+void StartupCustomizationDocument::Init(SystemAccess* system_access) {
+ if (!IsReady())
+ return;
root_->GetString(kInitialLocaleAttr, &initial_locale_);
root_->GetString(kInitialTimezoneAttr, &initial_timezone_);
@@ -112,7 +154,7 @@ bool StartupCustomizationDocument::LoadManifestFromString(
root_->GetString(kRegistrationUrlAttr, &registration_url_);
std::string hwid;
- if (system_access_->GetMachineStatistic(kHwid, &hwid)) {
+ if (system_access->GetMachineStatistic(kHwid, &hwid)) {
ListValue* hwid_list = NULL;
if (root_->GetList(kHwidMapAttr, &hwid_list)) {
for (size_t i = 0; i < hwid_list->GetSize(); ++i) {
@@ -143,14 +185,9 @@ bool StartupCustomizationDocument::LoadManifestFromString(
LOG(ERROR) << "HWID is missing in machine statistics";
}
- system_access_->GetMachineStatistic(kInitialLocaleAttr, &initial_locale_);
- system_access_->GetMachineStatistic(kInitialTimezoneAttr, &initial_timezone_);
- system_access_->GetMachineStatistic(kKeyboardLayoutAttr, &keyboard_layout_);
-
- // system_access_ is no longer used.
- system_access_ = NULL;
-
- return true;
+ system_access->GetMachineStatistic(kInitialLocaleAttr, &initial_locale_);
+ system_access->GetMachineStatistic(kInitialTimezoneAttr, &initial_timezone_);
+ system_access->GetMachineStatistic(kKeyboardLayoutAttr, &keyboard_layout_);
}
std::string StartupCustomizationDocument::GetHelpPage(
@@ -163,7 +200,104 @@ std::string StartupCustomizationDocument::GetEULAPage(
return GetLocaleSpecificString(locale, kSetupContentAttr, kEulaPageAttr);
}
-// ServicesCustomizationDocument implementation.
+// ServicesCustomizationDocument implementation. -------------------------------
+
+ServicesCustomizationDocument::ServicesCustomizationDocument()
+ : url_(kServicesCustomizationManifestUrl) {
+}
+
+ServicesCustomizationDocument::ServicesCustomizationDocument(
+ const std::string& manifest) {
+ LoadManifestFromString(manifest);
+}
+
+// static
+ServicesCustomizationDocument* ServicesCustomizationDocument::GetInstance() {
+ return Singleton<ServicesCustomizationDocument,
+ DefaultSingletonTraits<ServicesCustomizationDocument> >::get();
+}
+
+// static
+void ServicesCustomizationDocument::RegisterPrefs(PrefService* local_state) {
+ local_state->RegisterBooleanPref(kServicesCustomizationAppliedPref, false);
+}
+
+// static
+bool ServicesCustomizationDocument::WasApplied() {
+ PrefService* prefs = g_browser_process->local_state();
+ return prefs->GetBoolean(kServicesCustomizationAppliedPref);
+}
+
+// static
+void ServicesCustomizationDocument::SetApplied(bool val) {
+ PrefService* prefs = g_browser_process->local_state();
+ prefs->SetBoolean(kServicesCustomizationAppliedPref, val);
+}
+
+void ServicesCustomizationDocument::StartFetching() {
+ if (url_.SchemeIsFile()) {
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ NewRunnableMethod(this,
+ &ServicesCustomizationDocument::ReadFileInBackground,
+ FilePath(url_.path())));
+ } else {
+ StartFileFetch();
+ }
+}
+
+void ServicesCustomizationDocument::ReadFileInBackground(const FilePath& file) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
+ std::string manifest;
+ if (file_util::ReadFileToString(file, &manifest)) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this,
+ &ServicesCustomizationDocument::LoadManifestFromString,
+ manifest));
+ } else {
+ VLOG(1) << "Failed to load services customization manifest from: "
+ << file.value();
+ }
+}
+
+void ServicesCustomizationDocument::StartFileFetch() {
+ DCHECK(url_.is_valid());
+ url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this));
+ url_fetcher_->set_request_context(
+ ProfileManager::GetDefaultProfile()->GetRequestContext());
+ url_fetcher_->Start();
+}
+
+void ServicesCustomizationDocument::OnURLFetchComplete(
+ const URLFetcher* source,
+ const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data) {
+ if (response_code == 200) {
+ LoadManifestFromString(data);
+ } else {
+ NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary();
+ if (!network->Connected() && num_retries_ < kMaxFetchRetries) {
+ num_retries_++;
+ retry_timer_.Start(base::TimeDelta::FromSeconds(kRetriesDelayInSec),
+ this, &ServicesCustomizationDocument::StartFileFetch);
+ return;
+ }
+ LOG(ERROR) << "URL fetch for services customization failed:"
+ << " response code = " << response_code
+ << " URL = " << url.spec();
+ }
+}
+
+bool ServicesCustomizationDocument::ApplyCustomization() {
+ // TODO(dpolukhin): apply customized apps, exts and support page.
+ SetApplied(true);
+ return true;
+}
+
std::string ServicesCustomizationDocument::GetInitialStartPage(
const std::string& locale) const {
return GetLocaleSpecificString(
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
index 91970c6..66d711a 100644
--- a/chrome/browser/chromeos/customization_document.h
+++ b/chrome/browser/chromeos/customization_document.h
@@ -8,12 +8,18 @@
#include <string>
-#include "base/file_path.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
+#include "base/timer.h"
#include "base/values.h"
+#include "chrome/common/net/url_fetcher.h"
+#include "googleurl/src/gurl.h"
class DictionaryValue;
+class FilePath;
class ListValue;
+class PrefService;
namespace chromeos {
@@ -22,13 +28,17 @@ class SystemAccess;
// Base class for OEM customization document classes.
class CustomizationDocument {
public:
- CustomizationDocument() {}
virtual ~CustomizationDocument() {}
+ // Return true if the document was successfully fetched and parsed.
+ bool IsReady() const { return root_.get(); }
+
+ protected:
+ CustomizationDocument() {}
+
virtual bool LoadManifestFromFile(const FilePath& manifest_path);
virtual bool LoadManifestFromString(const std::string& manifest);
- protected:
std::string GetLocaleSpecificString(const std::string& locale,
const std::string& dictionary_name,
const std::string& entry_name) const;
@@ -40,11 +50,12 @@ class CustomizationDocument {
};
// OEM startup customization document class.
+// Now StartupCustomizationDocument is loaded in c-tor so just after create it
+// may be ready or not (if manifest is missing or corrupted) and this state
+// won't be changed later (i.e. IsReady() always return the same value).
class StartupCustomizationDocument : public CustomizationDocument {
public:
- explicit StartupCustomizationDocument(SystemAccess* system_access);
-
- virtual bool LoadManifestFromString(const std::string& manifest);
+ static StartupCustomizationDocument* GetInstance();
const std::string& initial_locale() const { return initial_locale_; }
const std::string& initial_timezone() const { return initial_timezone_; }
@@ -55,11 +66,23 @@ class StartupCustomizationDocument : public CustomizationDocument {
std::string GetEULAPage(const std::string& locale) const;
private:
+ FRIEND_TEST(StartupCustomizationDocumentTest, Basic);
+ FRIEND_TEST(StartupCustomizationDocumentTest, VPD);
+ FRIEND_TEST(StartupCustomizationDocumentTest, BadManifest);
+ friend struct DefaultSingletonTraits<StartupCustomizationDocument>;
+
+ // C-tor for singleton construction.
+ StartupCustomizationDocument();
+
+ // C-tor for test construction.
+ StartupCustomizationDocument(SystemAccess* system_access,
+ const std::string& manifest);
+
+ void Init(SystemAccess* system_access);
+
// If |attr| exists in machine stat, assign it to |value|.
void InitFromMachineStatistic(const char* attr, std::string* value);
- SystemAccess* system_access_;
-
std::string initial_locale_;
std::string initial_timezone_;
std::string keyboard_layout_;
@@ -69,14 +92,72 @@ class StartupCustomizationDocument : public CustomizationDocument {
};
// OEM services customization document class.
-class ServicesCustomizationDocument : public CustomizationDocument {
+// ServicesCustomizationDocument is fetched from network or local file but on
+// FILE thread therefore it may not be ready just after creation. Fetching of
+// the manifest should be initiated outside this class by calling
+// StartFetching() method. User of the file should check IsReady before use it.
+class ServicesCustomizationDocument : public CustomizationDocument,
+ private URLFetcher::Delegate {
public:
- ServicesCustomizationDocument() {}
+ static ServicesCustomizationDocument* GetInstance();
+
+ // Registers preferences.
+ static void RegisterPrefs(PrefService* local_state);
+
+ // Return true if the customization was applied. Customization is applied only
+ // once per machine.
+ static bool WasApplied();
+
+ // Start fetching customization document.
+ void StartFetching();
+
+ // Apply customization and save in machine options that customization was
+ // applied successfully. Return true if customization was applied.
+ bool ApplyCustomization();
std::string GetInitialStartPage(const std::string& locale) const;
std::string GetSupportPage(const std::string& locale) const;
private:
+ FRIEND_TEST(ServicesCustomizationDocumentTest, Basic);
+ FRIEND_TEST(ServicesCustomizationDocumentTest, BadManifest);
+ friend struct DefaultSingletonTraits<ServicesCustomizationDocument>;
+
+ // C-tor for singleton construction.
+ ServicesCustomizationDocument();
+
+ // C-tor for test construction.
+ explicit ServicesCustomizationDocument(const std::string& manifest);
+
+ // Save applied state in machine settings.
+ static void SetApplied(bool val);
+
+ // Overriden from URLFetcher::Delegate:
+ virtual void OnURLFetchComplete(const URLFetcher* source,
+ const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data);
+
+ // Initiate file fetching.
+ void StartFileFetch();
+
+ // Executes on FILE thread and reads file to string.
+ void ReadFileInBackground(const FilePath& file);
+
+ // Services customization manifest URL.
+ GURL url_;
+
+ // URLFetcher instance.
+ scoped_ptr<URLFetcher> url_fetcher_;
+
+ // Timer to retry fetching file if network is not available.
+ base::OneShotTimer<ServicesCustomizationDocument> retry_timer_;
+
+ // How many times we already tried to fetch customization manifest file.
+ int num_retries_;
+
DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
};
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index 83ad104..370f99c 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -85,8 +85,8 @@ TEST(StartupCustomizationDocumentTest, Basic) {
GetMachineStatistic(std::string("hwid"), NotNull()))
.WillOnce(DoAll(SetArgumentPointee<1>(std::string("Mario 12345")),
Return(true)));
- StartupCustomizationDocument customization(&mock_system_access);
- EXPECT_TRUE(customization.LoadManifestFromString(kGoodStartupManifest));
+ StartupCustomizationDocument customization(&mock_system_access,
+ kGoodStartupManifest);
EXPECT_EQ(customization.initial_locale(), "ru-RU");
EXPECT_EQ(customization.initial_timezone(), "Europe/Moscow");
EXPECT_EQ(customization.keyboard_layout(), "xkb:ru::rus");
@@ -125,8 +125,9 @@ TEST(StartupCustomizationDocumentTest, VPD) {
GetMachineStatistic(std::string("keyboard_layout"), NotNull()))
.WillOnce(DoAll(SetArgumentPointee<1>(std::string("mozc-jp")),
Return(true)));
- StartupCustomizationDocument customization(&mock_system_access);
- EXPECT_TRUE(customization.LoadManifestFromString(kGoodStartupManifest));
+ StartupCustomizationDocument customization(&mock_system_access,
+ kGoodStartupManifest);
+ EXPECT_TRUE(customization.IsReady());
EXPECT_EQ(customization.initial_locale(), "ja");
EXPECT_EQ(customization.initial_timezone(), "Asia/Tokyo");
EXPECT_EQ(customization.keyboard_layout(), "mozc-jp");
@@ -134,13 +135,13 @@ TEST(StartupCustomizationDocumentTest, VPD) {
TEST(StartupCustomizationDocumentTest, BadManifest) {
MockSystemAccess mock_system_access;
- StartupCustomizationDocument customization(&mock_system_access);
- EXPECT_FALSE(customization.LoadManifestFromString(kBadManifest));
+ StartupCustomizationDocument customization(&mock_system_access, kBadManifest);
+ EXPECT_FALSE(customization.IsReady());
}
TEST(ServicesCustomizationDocumentTest, Basic) {
- chromeos::ServicesCustomizationDocument customization;
- EXPECT_TRUE(customization.LoadManifestFromString(kGoodServicesManifest));
+ ServicesCustomizationDocument customization(kGoodServicesManifest);
+ EXPECT_TRUE(customization.IsReady());
EXPECT_EQ(customization.GetInitialStartPage("en-US"),
"http://mario/promo");
@@ -149,7 +150,6 @@ TEST(ServicesCustomizationDocumentTest, Basic) {
EXPECT_EQ(customization.GetInitialStartPage("ja"),
"http://mario/global/promo");
-
EXPECT_EQ(customization.GetSupportPage("en-US"),
"http://mario/us");
EXPECT_EQ(customization.GetSupportPage("ru-RU"),
@@ -159,8 +159,8 @@ TEST(ServicesCustomizationDocumentTest, Basic) {
}
TEST(ServicesCustomizationDocumentTest, BadManifest) {
- chromeos::ServicesCustomizationDocument customization;
- EXPECT_FALSE(customization.LoadManifestFromString(kBadManifest));
+ ServicesCustomizationDocument customization(kBadManifest);
+ EXPECT_FALSE(customization.IsReady());
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/apply_services_customization.cc b/chrome/browser/chromeos/login/apply_services_customization.cc
deleted file mode 100644
index 4b29e1c..0000000
--- a/chrome/browser/chromeos/login/apply_services_customization.cc
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (c) 2011 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/chromeos/login/apply_services_customization.h"
-
-#include "base/command_line.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/cros/network_library.h"
-#include "chrome/browser/chromeos/customization_document.h"
-#include "chrome/browser/chromeos/login/existing_user_controller.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "content/browser/browser_thread.h"
-#include "googleurl/src/gurl.h"
-
-namespace {
-
-// URL where to fetch OEM services customization manifest from.
-const char kServicesCustomizationManifestUrl[] =
- "file:///opt/oem/etc/services_manifest.json";
-
-// Name of local state option that tracks if services customization has been
-// applied.
-const char kServicesCustomizationAppliedPref[] = "ServicesCustomizationApplied";
-
-// Maximum number of retries to fetch file if network is not available.
-const int kMaxFetchRetries = 3;
-
-// Delay between file fetch retries if network is not available.
-const int kRetriesDelayInSec = 2;
-
-} // namespace
-
-DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::ApplyServicesCustomization);
-
-namespace chromeos {
-
-// static
-void ApplyServicesCustomization::StartIfNeeded() {
- if (!IsApplied()) {
- ApplyServicesCustomization* object =
- new ApplyServicesCustomization(kServicesCustomizationManifestUrl);
- if (!object->Init()) {
- delete object;
- }
- // |object| will be deleted on download complete.
- }
-}
-
-// static
-void ApplyServicesCustomization::RegisterPrefs(PrefService* local_state) {
- local_state->RegisterBooleanPref(kServicesCustomizationAppliedPref, false);
-}
-
-// static
-bool ApplyServicesCustomization::IsApplied() {
- PrefService* prefs = g_browser_process->local_state();
- return prefs->GetBoolean(kServicesCustomizationAppliedPref);
-}
-
-// static
-void ApplyServicesCustomization::SetApplied(bool val) {
- PrefService* prefs = g_browser_process->local_state();
- prefs->SetBoolean(kServicesCustomizationAppliedPref, val);
-}
-
-ApplyServicesCustomization::ApplyServicesCustomization(
- const std::string& url_str) : url_(url_str), num_retries_(0) {
-}
-
-bool ApplyServicesCustomization::Init() {
- DCHECK(url_.is_valid());
- if (!url_.is_valid()) {
- return false;
- }
-
- if (url_.SchemeIsFile()) {
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &ApplyServicesCustomization::ReadFileInBackground,
- FilePath(url_.path())));
- } else {
- StartFileFetch();
- }
-
- return true;
-}
-
-void ApplyServicesCustomization::StartFileFetch() {
- url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this));
- url_fetcher_->set_request_context(
- ProfileManager::GetDefaultProfile()->GetRequestContext());
- url_fetcher_->Start();
-}
-
-void ApplyServicesCustomization::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- if (response_code == 200) {
- Apply(data);
- } else {
- NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary();
- if (!network->Connected() && num_retries_ < kMaxFetchRetries) {
- num_retries_++;
- retry_timer_.Start(base::TimeDelta::FromSeconds(kRetriesDelayInSec),
- this, &ApplyServicesCustomization::StartFileFetch);
- return;
- }
- LOG(ERROR) << "URL fetch for services customization failed:"
- << " response code = " << response_code
- << " URL = " << url.spec();
- }
- MessageLoop::current()->DeleteSoon(FROM_HERE, this);
-}
-
-void ApplyServicesCustomization::ReadFileInBackground(const FilePath& file) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
-
- std::string manifest;
- if (file_util::ReadFileToString(file, &manifest)) {
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(
- this, &ApplyServicesCustomization::ApplyAndDelete, manifest));
- } else {
- VLOG(1) << "Failed to load services customization manifest from: "
- << file.value();
- BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
- }
-}
-
-void ApplyServicesCustomization::ApplyAndDelete(const std::string& manifest) {
- Apply(manifest);
- MessageLoop::current()->DeleteSoon(FROM_HERE, this);
-}
-
-void ApplyServicesCustomization::Apply(const std::string& manifest) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- chromeos::ServicesCustomizationDocument customization;
- if (!customization.LoadManifestFromString(manifest)) {
- LOG(ERROR) << "Failed to partner parse services customizations manifest";
- return;
- }
-
- VLOG(1) << "Partner services customizations manifest loaded successfully";
- std::string locale = g_browser_process->GetApplicationLocale();
- std::string initial_start_page = customization.GetInitialStartPage(locale);
- if (!initial_start_page.empty()) {
- VLOG(1) << "initial_start_page_url: " << initial_start_page;
- ExistingUserController* current_controller =
- ExistingUserController::current_controller();
- if (current_controller) {
- current_controller->set_initial_start_page(initial_start_page);
- } else {
- // Exit here to don't safe that manifest was applied.
- return;
- }
- }
- // TODO(dpolukhin): apply customized apps, exts and support page.
-
- SetApplied(true);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/apply_services_customization.h b/chrome/browser/chromeos/login/apply_services_customization.h
deleted file mode 100644
index 153aaf1..0000000
--- a/chrome/browser/chromeos/login/apply_services_customization.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/common/net/url_fetcher.h"
-#include "googleurl/src/gurl.h"
-
-class FilePath;
-class PrefService;
-
-namespace chromeos {
-
-// This class fetches services customization document and apply it
-// as soon as the document is downloaded.
-class ApplyServicesCustomization : public URLFetcher::Delegate {
- public:
- // This method checks if service customization has been applied and if not
- // starts the process.
- static void StartIfNeeded();
-
- // Registers preferences.
- static void RegisterPrefs(PrefService* local_state);
-
- // Returns true if service customization has been applied.
- static bool IsApplied();
-
- private:
- explicit ApplyServicesCustomization(const std::string& url_str);
-
- // Initiate URL fetch, return true if the object will delete itself later.
- bool Init();
-
- // Initiate file fetching.
- void StartFileFetch();
-
- // Overriden from URLFetcher::Delegate:
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-
- // Applies given |manifest|.
- void Apply(const std::string& manifest);
-
- // Applies given |manifest| and delete this object.
- void ApplyAndDelete(const std::string& manifest);
-
- // Executes on FILE thread and reads file to string.
- void ReadFileInBackground(const FilePath& file);
-
- // Remember in local state status of kServicesCustomizationAppliedPref.
- static void SetApplied(bool val);
-
- // Services customization manifest URL.
- GURL url_;
-
- // URLFetcher instance.
- scoped_ptr<URLFetcher> url_fetcher_;
-
- // Timer to retry fetching file if network is not available.
- base::OneShotTimer<ApplyServicesCustomization> retry_timer_;
-
- // How many times we already tried to fetch customization manifest file.
- int num_retries_;
-
- DISALLOW_COPY_AND_ASSIGN(ApplyServicesCustomization);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
diff --git a/chrome/browser/chromeos/login/base_login_display_host.cc b/chrome/browser/chromeos/login/base_login_display_host.cc
index c8dc9f3..2a081aa 100644
--- a/chrome/browser/chromeos/login/base_login_display_host.cc
+++ b/chrome/browser/chromeos/login/base_login_display_host.cc
@@ -11,9 +11,9 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/input_method_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
+#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/language_preferences.h"
-#include "chrome/browser/chromeos/login/apply_services_customization.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/language_switch_menu.h"
@@ -104,13 +104,11 @@ void BaseLoginDisplayHost::OnSessionStart() {
void BaseLoginDisplayHost::StartWizard(
const std::string& first_screen_name,
- const chromeos::StartupCustomizationDocument* manifest,
const GURL& start_url) {
DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name;
// Create and show the wizard.
wizard_controller_.reset(); // Only one controller in a time.
wizard_controller_.reset(new WizardController(this, background_bounds_));
- wizard_controller_->SetCustomization(manifest);
wizard_controller_->set_start_url(start_url);
ShowBackground();
if (!WizardController::IsDeviceRegistered())
@@ -138,8 +136,9 @@ void BaseLoginDisplayHost::StartSignInScreen() {
SetShutdownButtonEnabled(true);
sign_in_controller_->Init(users);
- // Initiate services customization.
- chromeos::ApplyServicesCustomization::StartIfNeeded();
+ // Initiate service customization manifest fetching.
+ if (!ServicesCustomizationDocument::WasApplied())
+ ServicesCustomizationDocument::GetInstance()->StartFetching();
}
// BaseLoginDisplayHost --------------------------------------------------------
@@ -215,10 +214,10 @@ void ShowLoginWizard(const std::string& first_screen_name,
// Load startup manifest.
const chromeos::StartupCustomizationDocument* startup_manifest =
- chromeos::LoadStartupManifest();
+ chromeos::StartupCustomizationDocument::GetInstance();
std::string locale;
- if (startup_manifest) {
+ if (startup_manifest->IsReady()) {
// Switch to initial locale if specified by customization
// and has not been set yet. We cannot call
// chromeos::LanguageSwitchMenu::SwitchLanguage here before
@@ -261,13 +260,13 @@ void ShowLoginWizard(const std::string& first_screen_name,
}
}
- display_host->StartWizard(first_screen_name, startup_manifest, GURL());
+ display_host->StartWizard(first_screen_name, GURL());
chromeos::LoginUtils::Get()->PrewarmAuthentication();
if (chromeos::CrosLibrary::Get()->EnsureLoaded())
chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady();
- if (startup_manifest) {
+ if (startup_manifest->IsReady()) {
// Set initial timezone if specified by customization.
const std::string timezone_name = startup_manifest->initial_timezone();
VLOG(1) << "Initial time zone: " << timezone_name;
diff --git a/chrome/browser/chromeos/login/base_login_display_host.h b/chrome/browser/chromeos/login/base_login_display_host.h
index 4170d09..db2a539 100644
--- a/chrome/browser/chromeos/login/base_login_display_host.h
+++ b/chrome/browser/chromeos/login/base_login_display_host.h
@@ -42,7 +42,6 @@ class BaseLoginDisplayHost : public LoginDisplayHost,
virtual void OnSessionStart();
virtual void StartWizard(
const std::string& first_screen_name,
- const chromeos::StartupCustomizationDocument* manifest,
const GURL& start_url);
virtual void StartSignInScreen();
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index a732f1b..d47522d 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -320,8 +320,8 @@ static void SetUpGridLayout(views::GridLayout* layout) {
// displayed using current locale and manifest. Returns empty URL otherwise.
static GURL GetOemEulaPagePath() {
const StartupCustomizationDocument* customization =
- WizardController::default_controller()->GetCustomization();
- if (customization) {
+ StartupCustomizationDocument::GetInstance();
+ if (customization->IsReady()) {
std::string locale = customization->initial_locale();
std::string eula_page = customization->GetEULAPage(locale);
if (!eula_page.empty())
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 599062a..918fb09 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
+#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/login_display_host.h"
#include "chrome/browser/chromeos/login/views_login_display.h"
@@ -226,7 +227,7 @@ void ExistingUserController::OnEnrollmentOwnershipCheckCompleted(
OwnershipService::Status status) {
if (status == OwnershipService::OWNERSHIP_NONE) {
host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName,
- NULL, GURL());
+ GURL());
login_display_->OnFadeOut();
}
ownership_checker_.reset();
@@ -334,10 +335,15 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
CommandLine::ForCurrentProcess()->AppendArg(kGetStartedURL);
#endif // OFFICIAL_BUILD
- if (!initial_start_page_.empty()) {
- // If initial_start_page is not empty, add it as second tab.
- // The tabs are opened in the same order as arguments in command line.
- CommandLine::ForCurrentProcess()->AppendArg(initial_start_page_);
+ ServicesCustomizationDocument* customization =
+ ServicesCustomizationDocument::GetInstance();
+ if (customization->IsReady()) {
+ std::string locale = g_browser_process->GetApplicationLocale();
+ std::string initial_start_page =
+ customization->GetInitialStartPage(locale);
+ if (!initial_start_page.empty())
+ CommandLine::ForCurrentProcess()->AppendArg(initial_start_page);
+ customization->ApplyCustomization();
}
if (two_factor_credentials_) {
@@ -431,7 +437,7 @@ void ExistingUserController::ActivateWizard(const std::string& screen_name) {
GURL start_url;
if (chromeos::UserManager::Get()->IsLoggedInAsGuest())
start_url = guest_mode_url_;
- host_->StartWizard(screen_name, NULL, start_url);
+ host_->StartWizard(screen_name, start_url);
login_display_->OnFadeOut();
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index f01b422..5719398 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -55,10 +55,6 @@ class ExistingUserController : public LoginDisplay::Delegate,
return current_controller_;
}
- void set_initial_start_page(const std::string& url) {
- initial_start_page_ = url;
- }
-
// Creates and shows login UI for known users.
void Init(const UserVector& users);
@@ -159,9 +155,6 @@ class ExistingUserController : public LoginDisplay::Delegate,
// URL to append to start Guest mode with.
GURL guest_mode_url_;
- // URL to open on first owner login from OEM customization manifest.
- std::string initial_start_page_;
-
// Used for user image changed notifications.
NotificationRegistrar registrar_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
index 1c00487..0b2a25f 100644
--- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -65,8 +65,7 @@ class MockLoginDisplayHost : public LoginDisplayHost {
MOCK_METHOD1(SetStatusAreaEnabled, void(bool));
MOCK_METHOD1(SetStatusAreaVisible, void(bool));
MOCK_METHOD0(ShowBackground, void(void));
- MOCK_METHOD3(StartWizard, void(const std::string&,
- const chromeos::StartupCustomizationDocument*,
+ MOCK_METHOD2(StartWizard, void(const std::string&,
const GURL&));
MOCK_METHOD0(StartSignInScreen, void(void));
@@ -186,7 +185,6 @@ IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, NewUserLogin) {
.Times(1);
EXPECT_CALL(*mock_login_display_host_,
StartWizard(WizardController::kUserImageScreenName,
- NULL,
GURL()))
.Times(1);
EXPECT_CALL(*mock_login_display_, OnFadeOut())
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index d91fc12..929482f 100644
--- a/chrome/browser/chromeos/login/helper.cc
+++ b/chrome/browser/chromeos/login/helper.cc
@@ -6,7 +6,6 @@
#include "base/file_util.h"
#include "chrome/browser/chromeos/cros/network_library.h"
-#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/system_access.h"
#include "chrome/browser/google/google_util.h"
#include "googleurl/src/gurl.h"
@@ -42,10 +41,6 @@ const SkColor kBackgroundEdgeColor = SK_ColorBLACK;
const char kAccountRecoveryHelpUrl[] =
"https://www.google.com/support/accounts/bin/answer.py?answer=48598";
-// Path to OEM partner startup customization manifest.
-const char kStartupCustomizationManifestPath[] =
- "/opt/oem/etc/startup_manifest.json";
-
class BackgroundPainter : public views::Painter {
public:
BackgroundPainter() {}
@@ -225,28 +220,6 @@ string16 GetCurrentNetworkName(NetworkLibrary* network_library) {
}
}
-const chromeos::StartupCustomizationDocument* LoadStartupManifest() {
- // Loading manifest causes us to do blocking IO on UI thread.
- // Temporarily allow it until we fix http://crosbug.com/11103
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- FilePath startup_manifest_path(kStartupCustomizationManifestPath);
- if (file_util::PathExists(startup_manifest_path)) {
- chromeos::SystemAccess* system = chromeos::SystemAccess::GetInstance();
- scoped_ptr<chromeos::StartupCustomizationDocument> customization(
- new chromeos::StartupCustomizationDocument(system));
- bool manifest_loaded = customization->LoadManifestFromFile(
- startup_manifest_path);
- if (manifest_loaded) {
- VLOG(1) << "Startup manifest loaded successfully";
- return customization.release();
- }
- LOG(ERROR) << "Error loading startup manifest: "
- << kStartupCustomizationManifestPath;
- }
-
- return NULL;
-}
-
namespace login {
gfx::Size WideButton::GetPreferredSize() {
diff --git a/chrome/browser/chromeos/login/helper.h b/chrome/browser/chromeos/login/helper.h
index d385a21..7cc2c07 100644
--- a/chrome/browser/chromeos/login/helper.h
+++ b/chrome/browser/chromeos/login/helper.h
@@ -32,7 +32,6 @@ class Widget;
namespace chromeos {
-class StartupCustomizationDocument;
class NetworkLibrary;
// View that provides interface for start/stop throbber above the view.
@@ -108,10 +107,6 @@ GURL GetAccountRecoveryHelpUrl();
// Ethernet > WiFi > Cellular. Same for connecting network.
string16 GetCurrentNetworkName(NetworkLibrary* network_library);
-// Load OEM partner startup customization manifest
-// containing locale, timezone, EULA, etc.
-const chromeos::StartupCustomizationDocument* LoadStartupManifest();
-
// Define the constants in |login| namespace to avoid potential
// conflict with other chromeos components.
namespace login {
diff --git a/chrome/browser/chromeos/login/login_display_host.h b/chrome/browser/chromeos/login/login_display_host.h
index d371572..a1d051a 100644
--- a/chrome/browser/chromeos/login/login_display_host.h
+++ b/chrome/browser/chromeos/login/login_display_host.h
@@ -59,7 +59,6 @@ class LoginDisplayHost {
// One could specify start screen with |first_screen_name|.
virtual void StartWizard(
const std::string& first_screen_name,
- const chromeos::StartupCustomizationDocument* manifest,
const GURL& start_url) = 0;
// Starts sign in screen.
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index d18ef48..e7adcc3 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/account_screen.h"
-#include "chrome/browser/chromeos/login/apply_services_customization.h"
#include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h"
#include "chrome/browser/chromeos/login/eula_view.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
@@ -177,13 +176,6 @@ class ContentView : public views::View {
DISALLOW_COPY_AND_ASSIGN(ContentView);
};
-// Returns true if startup manifest defines valid registration URL.
-bool IsRegistrationScreenValid(
- const chromeos::StartupCustomizationDocument* startup_manifest) {
- return startup_manifest != NULL &&
- GURL(startup_manifest->registration_url()).is_valid();
-}
-
// Saves boolean "Local State" preference and forces its persistence to disk.
void SaveBoolPreferenceForced(const char* pref_name, bool value) {
PrefService* prefs = g_browser_process->local_state();
@@ -273,12 +265,6 @@ void WizardController::Init(const std::string& first_screen_name) {
DCHECK(!contents_);
first_screen_name_ = first_screen_name;
- // When device is not registered yet we need to load startup manifest as well.
- // In case of OOBE (network-EULA-update) manifest has been loaded in
- // ShowLoginWizard().
- if (IsOobeCompleted() && !IsDeviceRegistered())
- SetCustomization(chromeos::LoadStartupManifest());
-
contents_ = new ContentView();
bool oobe_complete = IsOobeCompleted();
@@ -414,7 +400,7 @@ void WizardController::ShowEulaScreen() {
}
void WizardController::ShowRegistrationScreen() {
- if (!IsRegistrationScreenValid(GetCustomization())) {
+ if (!IsRegisterScreenDefined()) {
VLOG(1) << "Skipping registration screen: manifest not defined or invalid "
"URL.";
OnRegistrationSkipped();
@@ -441,16 +427,6 @@ void WizardController::ShowEnterpriseEnrollmentScreen() {
SetCurrentScreen(GetEnterpriseEnrollmentScreen());
}
-void WizardController::SetCustomization(
- const chromeos::StartupCustomizationDocument* customization) {
- customization_.reset(customization);
-}
-
-const chromeos::StartupCustomizationDocument*
- WizardController::GetCustomization() const {
- return customization_.get();
-}
-
void WizardController::SkipRegistration() {
if (current_screen_ == GetRegistrationScreen())
OnRegistrationSkipped();
@@ -812,14 +788,10 @@ void WizardController::SetInitialLocale(const std::string& locale) {
// static
bool WizardController::IsRegisterScreenDefined() {
- const chromeos::StartupCustomizationDocument* manifest = NULL;
- // This method will be called from ExistingUserController too
- // when Wizard instance doesn't exist.
- if (default_controller())
- manifest = default_controller()->GetCustomization();
- else
- manifest = chromeos::LoadStartupManifest();
- return IsRegistrationScreenValid(manifest);
+ const chromeos::StartupCustomizationDocument* manifest =
+ chromeos::StartupCustomizationDocument::GetInstance();
+ return manifest->IsReady() &&
+ GURL(manifest->registration_url()).is_valid();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 2f809a9..d2db119 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -30,7 +30,6 @@ class HTMLPageScreen;
class LoginDisplayHost;
class NetworkScreen;
class RegistrationScreen;
-class StartupCustomizationDocument;
class UpdateScreen;
class UserImageScreen;
class WizardInProcessBrowserTest;
@@ -131,14 +130,6 @@ class WizardController : public chromeos::ScreenObserver,
// Set URL to open on browser launch.
void set_start_url(const GURL& start_url) { start_url_ = start_url; }
- // Sets partner startup customization. WizardController takes ownership
- // of the document object.
- void SetCustomization(
- const chromeos::StartupCustomizationDocument* customization);
-
- // Returns partner startup customization document owned by WizardController.
- const chromeos::StartupCustomizationDocument* GetCustomization() const;
-
// If being at register screen proceeds to the next one.
void SkipRegistration();
@@ -274,9 +265,6 @@ class WizardController : public chromeos::ScreenObserver,
// Default WizardController.
static WizardController* default_controller_;
- // Partner startup customizations.
- scoped_ptr<const chromeos::StartupCustomizationDocument> customization_;
-
// URL to open on browser launch.
GURL start_url_;
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 2df2b2e4..85766d3 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -71,7 +71,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/audio_mixer_alsa.h"
-#include "chrome/browser/chromeos/login/apply_services_customization.h"
+#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/login/signed_settings_temp_storage.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
@@ -117,7 +117,7 @@ void RegisterLocalState(PrefService* local_state) {
chromeos::UserCrosSettingsProvider::RegisterPrefs(local_state);
WizardController::RegisterPrefs(local_state);
chromeos::InputMethodMenu::RegisterPrefs(local_state);
- chromeos::ApplyServicesCustomization::RegisterPrefs(local_state);
+ chromeos::ServicesCustomizationDocument::RegisterPrefs(local_state);
chromeos::SignedSettingsTempStorage::RegisterPrefs(local_state);
#endif
}
diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.cc b/chrome/browser/ui/webui/chromeos/register_page_ui.cc
index 24764c2..5b4c21b 100644
--- a/chrome/browser/ui/webui/chromeos/register_page_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/register_page_ui.cc
@@ -219,10 +219,11 @@ void RegisterPageHandler::RegisterMessages() {
void RegisterPageHandler::HandleGetRegistrationUrl(const ListValue* args) {
#if defined(OS_CHROMEOS)
+ chromeos::StartupCustomizationDocument* customization =
+ chromeos::StartupCustomizationDocument::GetInstance();
if (WizardController::default_controller() &&
- WizardController::default_controller()->GetCustomization()) {
- const std::string& url = WizardController::default_controller()->
- GetCustomization()->registration_url();
+ customization->IsReady()) {
+ const std::string& url = customization->registration_url();
VLOG(1) << "Loading registration form with URL: " << url;
GURL register_url(url);
if (!register_url.is_valid()) {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1d52ea8..210a344 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -446,8 +446,6 @@
'browser/chromeos/login/account_creation_view.h',
'browser/chromeos/login/account_screen.cc',
'browser/chromeos/login/account_screen.h',
- 'browser/chromeos/login/apply_services_customization.cc',
- 'browser/chromeos/login/apply_services_customization.h',
'browser/chromeos/login/auth_attempt_state.cc',
'browser/chromeos/login/auth_attempt_state.h',
'browser/chromeos/login/auth_attempt_state_resolver.cc',