summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 20:03:32 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 20:03:32 +0000
commit9d5804f68add5c1ab7bb48be7989d798f0988375 (patch)
tree3b31ae298d7d2154337ac6622f8b361abef38f0b /chrome/browser/chromeos
parent044627eb27f28939855307d4f33cf46af33bd185 (diff)
downloadchromium_src-9d5804f68add5c1ab7bb48be7989d798f0988375.zip
chromium_src-9d5804f68add5c1ab7bb48be7989d798f0988375.tar.gz
chromium_src-9d5804f68add5c1ab7bb48be7989d798f0988375.tar.bz2
Revert 48424 - Adding initial implementation of the PartnerCustomization classes.
BUG=chromiumos:3176 TEST=Run out/Debug/unit_tests. Run out/Debug/chrome loginmanager startupmanifest=./chrome/browser/chromeos/testdata/startup_manifest.json. There should be no asserts. Review URL: http://codereview.chromium.org/2101021 TBR=denisromanov@chromium.org Build error below. I don't immediately see how this CL caused the problem, but the only other things on the blamelist are valgrind suppressions which don't change code. Linking... LINK : warning LNK4224: /OPT:NOWIN98 is no longer supported; ignored Creating library C:\b\slave\chromium-rel-builder\build\src\build\Release\lib\npchrome_frame.lib and object C:\b\slave\chromium-rel-builder\build\src\build\Release\lib\npchrome_frame.exp chrome_tab.obj : error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) chrome_frame_ie.lib(chrome_active_document.obj) : error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) chrome_frame_npapi.lib(utils.obj) : error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) C:\b\slave\chromium-rel-builder\build\src\build\Release\servers\npchrome_frame.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe (tool returned code: 1120) 2 build system warning(s): - VS settings folder not found - Interoperability reenabled Review URL: http://codereview.chromium.org/2224008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/customization_document.cc135
-rw-r--r--chrome/browser/chromeos/customization_document.h115
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc103
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc21
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.h9
-rw-r--r--chrome/browser/chromeos/testdata/startup_manifest.json22
6 files changed, 0 insertions, 405 deletions
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
deleted file mode 100644
index 883313f..0000000
--- a/chrome/browser/chromeos/customization_document.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2010 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/customization_document.h"
-
-#include <string>
-
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/json/json_reader.h"
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "base/values.h"
-
-// Manifest attributes names.
-
-namespace {
-
-const wchar_t kVersionAttr[] = L"version";
-const wchar_t kProductSkuAttr[] = L"product_sku";
-const wchar_t kInitialLocaleAttr[] = L"initial_locale";
-const wchar_t kBackgroundColorAttr[] = L"background_color";
-const wchar_t kRegistrationUrlAttr[] = L"registration_url";
-const wchar_t kSetupContentAttr[] = L"setup_content";
-const wchar_t kContentLocaleAttr[] = L"content_locale";
-const wchar_t kHelpPageAttr[] = L"help_page";
-const wchar_t kEulaPageAttr[] = L"eula_page";
-const wchar_t kAppMenuAttr[] = L"app_menu";
-const wchar_t kInitialStartPageAttr[] = L"initial_start_page";
-const wchar_t kSectionTitleAttr[] = L"section_title";
-const wchar_t kWebAppsAttr[] = L"web_apps";
-const wchar_t kSupportPageAttr[] = L"support_page";
-const wchar_t kExtensionsAttr[] = L"extensions";
-
-const char kAcceptedManifestVersion[] = "1.0";
-
-} // anonymous namespace
-
-namespace chromeos {
-
-// CustomizationDocument implementation.
-
-bool CustomizationDocument::LoadManifestFromFile(
- const FilePath& manifest_path) {
- std::string manifest;
- bool read_success = file_util::ReadFileToString(manifest_path, &manifest);
- if (!read_success) {
- return false;
- }
- return LoadManifestFromString(manifest);
-}
-
-bool CustomizationDocument::LoadManifestFromString(
- const std::string& manifest) {
- scoped_ptr<Value> root(base::JSONReader::Read(manifest, true));
- DCHECK(root.get() != NULL);
- if (root.get() == NULL)
- return false;
- DCHECK(root->GetType() == Value::TYPE_DICTIONARY);
- return ParseFromJsonValue(static_cast<DictionaryValue*>(root.get()));
-}
-
-bool CustomizationDocument::ParseFromJsonValue(const DictionaryValue* root) {
- // Partner customization manifests share only one required field -
- // version string.
- bool result = root->GetString(kVersionAttr, &version_);
- return result && version_ == kAcceptedManifestVersion;
-}
-
-// StartupCustomizationDocument implementation.
-
-bool StartupCustomizationDocument::ParseFromJsonValue(
- const DictionaryValue* root) {
- if (!CustomizationDocument::ParseFromJsonValue(root))
- return false;
- // Rquired fields.
- if (!root->GetString(kProductSkuAttr, &product_sku_))
- return false;
- // Optional fields.
- root->GetString(kInitialLocaleAttr, &initial_locale_);
- std::string background_color_string;
- root->GetString(kBackgroundColorAttr, &background_color_string);
- if (!background_color_string.empty()) {
- if (background_color_string[0] == '#') {
- background_color_ = static_cast<SkColor>(
- 0xff000000 | HexStringToInt(background_color_string.substr(1)));
- } else {
- // Literal color constants are not supported yet.
- return false;
- }
- }
- root->GetString(kRegistrationUrlAttr, &registration_url_);
- ListValue* setup_content_value = NULL;
- root->GetList(kSetupContentAttr, &setup_content_value);
- if (setup_content_value != NULL) {
- for (ListValue::const_iterator iter = setup_content_value->begin();
- iter != setup_content_value->end();
- ++iter) {
- const DictionaryValue* dict = NULL;
- dict = static_cast<const DictionaryValue*>(*iter);
- DCHECK(dict->GetType() == Value::TYPE_DICTIONARY);
- std::string content_locale;
- if (!dict->GetString(kContentLocaleAttr, &content_locale))
- return false;
- SetupContent content;
- if (!dict->GetString(kHelpPageAttr, &content.help_page_path))
- return false;
- if (!dict->GetString(kEulaPageAttr, &content.eula_page_path))
- return false;
- setup_content_[content_locale] = content;
- }
- }
- return true;
-}
-
-const StartupCustomizationDocument::SetupContent*
- StartupCustomizationDocument::GetSetupContent(
- const std::string& locale) const {
- SetupContentMap::const_iterator content_iter = setup_content_.find(locale);
- if (content_iter != setup_content_.end()) {
- return &content_iter->second;
- }
- return NULL;
-}
-
-// ServicesCustomizationDocument implementation.
-
-bool ServicesCustomizationDocument::ParseFromJsonValue(
- const DictionaryValue* root) {
- return CustomizationDocument::ParseFromJsonValue(root);
- // TODO(denisromanov): implement.
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
deleted file mode 100644
index ce9d68a..0000000
--- a/chrome/browser/chromeos/customization_document.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2010 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_CUSTOMIZATION_DOCUMENT_H_
-#define CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
-
-#include <list>
-#include <map>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "third_party/skia/include/core/SkColor.h"
-
-class DictionaryValue;
-class FilePath;
-
-namespace chromeos {
-
-class CustomizationDocument {
- public:
- CustomizationDocument() {}
- virtual ~CustomizationDocument() {}
-
- virtual bool LoadManifestFromFile(const FilePath& manifest_path);
- virtual bool LoadManifestFromString(const std::string& manifest);
-
- const std::string& version() const { return version_; }
-
- protected:
- // Parses manifest's attributes from the JSON dictionary value.
- virtual bool ParseFromJsonValue(const DictionaryValue* root);
-
- // Manifest version string.
- std::string version_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomizationDocument);
-};
-
-class StartupCustomizationDocument : public CustomizationDocument {
- public:
- struct SetupContent {
- SetupContent() {}
- SetupContent(const std::string& help_page_path,
- const std::string& eula_page_path)
- : help_page_path(help_page_path),
- eula_page_path(eula_page_path) {}
-
- // Partner's help page for specific locale.
- std::string help_page_path;
- // Partner's EULA for specific locale.
- std::string eula_page_path;
- };
-
- typedef std::map<std::string, SetupContent> SetupContentMap;
-
- StartupCustomizationDocument() {}
-
- const std::string& product_sku() const { return product_sku_; }
- const std::string& initial_locale() const { return initial_locale_; }
- SkColor background_color() const { return background_color_; }
- const std::string& registration_url() const { return registration_url_; }
-
- const SetupContent* GetSetupContent(const std::string& locale) const;
-
- protected:
- virtual bool ParseFromJsonValue(const DictionaryValue* root);
-
- // Product SKU.
- std::string product_sku_;
-
- // Initial locale for the OOBE wizard.
- std::string initial_locale_;
-
- // OOBE wizard and login screen background color.
- SkColor background_color_;
-
- // Partner's product registration page URL.
- std::string registration_url_;
-
- // Setup content for different locales.
- SetupContentMap setup_content_;
-
- DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument);
-};
-
-class ServicesCustomizationDocument : public CustomizationDocument {
- public:
- ServicesCustomizationDocument() {}
-
- protected:
- virtual bool ParseFromJsonValue(const DictionaryValue* root);
-
- // Partner's welcome page that is opened right after the OOBE.
- std::string initial_start_page_;
-
- // Title for the partner's apps section in apps menu.
- std::string app_menu_section_title_;
-
- // Partner's featured apps URLs.
- std::list<std::string> web_apps_;
-
- // Partner's featured extensions URLs.
- std::list<std::string> extensions_;
-
- // Partner's apps section support page URL.
- std::string app_menu_support_page_url_;
-
- DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
deleted file mode 100644
index c57a0c9..0000000
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2010 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/customization_document.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-const char kGoodStartupManifest[] =
- "{"
- " \"version\": \"1.0\","
- " \"product_sku\" : \"SKU\","
- " \"initial_locale\" : \"en_US\","
- " \"background_color\" : \"#880088\","
- " \"registration_url\" : \"http://www.google.com\","
- " \"setup_content\" : ["
- " {"
- " \"content_locale\" : \"en_US\","
- " \"help_page\" : \"setup_content/en_US/help.html\","
- " \"eula_page\" : \"setup_content/en_US/eula.html\","
- " },"
- " {"
- " \"content_locale\" : \"ru\","
- " \"help_page\" : \"setup_content/ru/help.html\","
- " \"eula_page\" : \"setup_content/ru/eula.html\","
- " },"
- " ]"
- "}";
-
-const char kBadStartupManifest1[] = "{}";
-const char kBadStartupManifest2[] = "{ \"version\" : \"1.0\" }";
-const char kBadStartupManifest3[] = "{"
- " \"version\" : \"0.0\","
- " \"product_sku\" : \"SKU\","
- "}";
-
-const char kBadStartupManifest4[] = "{"
- " \"version\" : \"1.0\","
- " \"product_sku\" : \"SKU\","
- " \"setup_content\" : ["
- " {"
- " \"help_page\" : \"setup_content/en_US/help.html\","
- " \"eula_page\" : \"setup_content/en_US/eula.html\","
- " },"
- " ]"
- "}";
-
-const char kBadStartupManifest5[] = "{"
- " \"version\" : \"1.0\","
- " \"product_sku\" : \"SKU\","
- " \"setup_content\" : ["
- " {"
- " \"content_locale\" : \"en_US\","
- " \"eula_page\" : \"setup_content/en_US/eula.html\","
- " },"
- " ]"
- "}";
-
-
-
-} // anonymous namespace
-
-class StartupCustomizationDocumentTest : public testing::Test {
- public:
- chromeos::StartupCustomizationDocument customization_;
-};
-
-TEST_F(StartupCustomizationDocumentTest, LoadBadStartupManifestFromString) {
- bool result = false;
- result = customization_.LoadManifestFromString(kBadStartupManifest1);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest2);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest3);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest4);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest5);
- EXPECT_EQ(result, false);
-}
-
-TEST_F(StartupCustomizationDocumentTest, LoadGoodStartupManifestFromString) {
- bool result = false;
- result = customization_.LoadManifestFromString(kGoodStartupManifest);
- EXPECT_EQ(result, true);
- EXPECT_EQ(customization_.version(), "1.0");
- EXPECT_EQ(customization_.product_sku(), "SKU");
- EXPECT_EQ(customization_.initial_locale(), "en_US");
- EXPECT_EQ(customization_.background_color(),
- SkColorSetRGB(0x88, 0x00, 0x88));
- EXPECT_EQ(customization_.registration_url(), "http://www.google.com");
-
- EXPECT_EQ(customization_.GetSetupContent("en_US")->help_page_path,
- "setup_content/en_US/help.html");
- EXPECT_EQ(customization_.GetSetupContent("en_US")->eula_page_path,
- "setup_content/en_US/eula.html");
- EXPECT_EQ(customization_.GetSetupContent("ru")->help_page_path,
- "setup_content/ru/help.html");
- EXPECT_EQ(customization_.GetSetupContent("ru")->eula_page_path,
- "setup_content/ru/eula.html");
-}
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 7f92d0e..aba9c94 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -16,7 +16,6 @@
#include "base/logging.h" // For NOTREACHED.
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
-#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/login/account_screen.h"
#include "chrome/browser/chromeos/login/background_view.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
@@ -164,7 +163,6 @@ WizardController* WizardController::default_controller_ = NULL;
///////////////////////////////////////////////////////////////////////////////
// WizardController, public:
-
WizardController::WizardController()
: widget_(NULL),
background_widget_(NULL),
@@ -300,11 +298,6 @@ void WizardController::SetStatusAreaVisible(bool visible) {
}
}
-void WizardController::SetCustomization(
- const chromeos::StartupCustomizationDocument* customization) {
- customization_.reset(customization);
-}
-
///////////////////////////////////////////////////////////////////////////////
// WizardController, ExitHandlers:
void WizardController::OnLoginSignInSelected() {
@@ -481,21 +474,7 @@ void ShowLoginWizard(const std::string& first_screen_name,
}
}
- // Load partner customization startup manifest if needed.
- scoped_ptr<chromeos::StartupCustomizationDocument> customization;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kStartupManifest)) {
- customization.reset(new chromeos::StartupCustomizationDocument());
- FilePath manifest_path =
- CommandLine::ForCurrentProcess()->GetSwitchValuePath(
- switches::kStartupManifest);
- bool manifest_loaded = customization->LoadManifestFromFile(manifest_path);
- DCHECK(manifest_loaded) << manifest_path.value();
- }
-
- // Create and show the wizard.
WizardController* controller = new WizardController();
- controller->SetCustomization(customization.release());
controller->ShowBackground(screen_bounds);
controller->Init(first_screen_name, screen_bounds, true);
controller->Show();
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 25d3939..d66ed15 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -22,7 +22,6 @@ class BackgroundView;
class LoginScreen;
class NetworkScreen;
class UpdateScreen;
-class StartupCustomizationDocument;
}
namespace gfx {
@@ -88,11 +87,6 @@ class WizardController : public chromeos::ScreenObserver,
// Overrides observer for testing.
void set_observer(ScreenObserver* observer) { observer_ = observer; }
- // Sets partner startup customization. WizardController takes ownership
- // of the document object.
- void SetCustomization(
- const chromeos::StartupCustomizationDocument* customization);
-
static const char kNetworkScreenName[];
static const char kLoginScreenName[];
static const char kAccountScreenName[];
@@ -162,9 +156,6 @@ class WizardController : public chromeos::ScreenObserver,
// Default WizardController.
static WizardController* default_controller_;
- // Partner startup customizations.
- scoped_ptr<const chromeos::StartupCustomizationDocument> customization_;
-
FRIEND_TEST(WizardControllerFlowTest, ControlFlowErrorNetwork);
FRIEND_TEST(WizardControllerFlowTest, ControlFlowErrorUpdate);
FRIEND_TEST(WizardControllerFlowTest, ControlFlowLanguageOnLogin);
diff --git a/chrome/browser/chromeos/testdata/startup_manifest.json b/chrome/browser/chromeos/testdata/startup_manifest.json
deleted file mode 100644
index ba1faac..0000000
--- a/chrome/browser/chromeos/testdata/startup_manifest.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- // Required.
- "version": "1.0",
- "product_sku" : "SKU",
-
- // Optional.
- "initial_locale" : "en_US",
- "background_color" : "#880088",
- "registration_url" : "http://www.google.com",
- "setup_content" : [
- {
- "content_locale" : "en_US",
- "help_page" : "setup_content/en_US/help.html",
- "eula_page" : "setup_content/en_US/eula.html",
- },
- {
- "content_locale" : "ru",
- "help_page" : "setup_content/ru/help.html",
- "eula_page" : "setup_content/ru/eula.html",
- },
- ]
-}