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

Unified Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 3026006: Fixed problems with initial locale change freezing Chrome OS on the device.... (Closed) Base URL: svn://chrome-svn/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
Index: chrome/browser/chromeos/login/wizard_controller.cc
===================================================================
--- chrome/browser/chromeos/login/wizard_controller.cc (revision 52817)
+++ chrome/browser/chromeos/login/wizard_controller.cc (working copy)
@@ -14,6 +14,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/file_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
@@ -51,6 +52,19 @@
// A boolean pref of the OOBE complete flag.
const wchar_t kOobeComplete[] = L"OobeComplete";
+// Path to OEM partner startup customization manifest.
+const char kStartupCustomizationManifestPath[] =
+ "/mnt/partner_partition/etc/chromeos/startup_manifest.json";
+
+// URL where to fetch OEM services customization manifest from.
+// TODO(denisromanov): Change this to real URL when it becomes available.
Nikita (slow) 2010/07/19 12:31:19 Please file issue to track this and mention it her
+const char kServicesCustomizationManifestUrl[] =
+ "file:///mnt/partner_partition/etc/chromeos/services_manifest.json";
+
+// Path to flag file indicating that OOBE was completed successfully.
+const char kOobeCompleteFlagFilePath[] =
+ "/home/chronos/.oobe_completed";
+
// Default size of the OOBE screen.
const int kWizardScreenWidth = 700;
const int kWizardScreenHeight = 416;
@@ -153,6 +167,8 @@
void DeleteWizardControllerAndLaunchBrowser(WizardController* controller) {
delete controller;
+ // Apply OEM partner services customizations.
+ controller->ApplyPartnerServicesCustomizations();
Nikita (slow) 2010/07/19 12:31:19 It seems like a not the best place to apply these
// Launch browser after controller is deleted and its windows are closed.
chromeos::LoginUtils::Get()->EnableBrowserLaunch(true);
ChromeThread::PostTask(
@@ -343,6 +359,14 @@
}
SetCurrentScreen(GetLoginScreen());
+
+ LOG(INFO) << "WTF: " << (is_out_of_box_ ? "out" : "in");
Nikita (slow) 2010/07/19 12:31:19 Debug info - should be removed? At least place a d
+
+ if (is_out_of_box_) {
+ // Initiate fetching partner services manifest here.
+ services_manifest_fetcher_.reset(new StringFetcher(
Nikita (slow) 2010/07/19 12:31:19 We're fetching manifest during OOBE welcome-update
+ kServicesCustomizationManifestUrl));
+ }
}
void WizardController::ShowAccountScreen() {
@@ -557,8 +581,36 @@
prefs->SetBoolean(kOobeComplete, true);
// Make sure that changes are reflected immediately.
prefs->SavePersistentPrefs();
+ // Create flag file for boot-time init scripts.
+ FilePath oobe_complete_path(kOobeCompleteFlagFilePath);
+ FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b");
+ DCHECK(oobe_flag_file != NULL) << kOobeCompleteFlagFilePath;
+ if (oobe_flag_file != NULL)
+ file_util::CloseFile(oobe_flag_file);
}
+void WizardController::ApplyPartnerServicesCustomizations() {
+ if (services_manifest_fetcher_.get() == NULL ||
+ services_manifest_fetcher_->result().empty()) {
+ return;
+ }
+ scoped_ptr<chromeos::ServicesCustomizationDocument> customization;
+ bool manifest_loaded;
+ customization.reset(new chromeos::ServicesCustomizationDocument());
+ manifest_loaded = customization->LoadManifestFromString(
+ services_manifest_fetcher_->result());
+ DCHECK(manifest_loaded) << "Customization manifest fetch error: "
+ << services_manifest_fetcher_->result();
+ if (!manifest_loaded)
+ return;
+ if (!customization->initial_start_page_url().empty()) {
+ // Append partner's start page url to command line so it gets opened
+ // on browser startup.
+ CommandLine::ForCurrentProcess()->AppendLooseValue(
+ UTF8ToWide(customization->initial_start_page_url()));
+ }
Nikita (slow) 2010/07/19 12:31:19 apps + exts + support page?
+}
+
///////////////////////////////////////////////////////////////////////////////
// WizardController, chromeos::ScreenObserver overrides:
void WizardController::OnExit(ExitCodes exit_code) {
@@ -669,45 +721,48 @@
scoped_ptr<chromeos::StartupCustomizationDocument> customization;
- if (!oobe_complete) {
- // Load partner customization startup manifest if needed.
- 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();
- }
+ // Load partner customization startup manifest if it is available.
+ FilePath startup_manifest_path(kStartupCustomizationManifestPath);
+ if (file_util::PathExists(startup_manifest_path)) {
Nikita (slow) 2010/07/19 12:31:19 Please add check that startup manifest should exis
+ customization.reset(new chromeos::StartupCustomizationDocument());
+ bool manifest_loaded = customization->LoadManifestFromFile(
+ FilePath(kStartupCustomizationManifestPath));
+ DCHECK(manifest_loaded) << kStartupCustomizationManifestPath;
+ if (!manifest_loaded)
+ customization.reset(NULL);
+ }
- // Do UX customizations if needed.
- if (customization != NULL) {
- // Switch to initial locale if specified by customization.
+ if (chromeos::CrosLibrary::Get()->EnsureLoaded())
+ chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady();
Nikita (slow) 2010/07/19 12:31:19 We should look deeper into it. Emitting login_prom
Nikita (slow) 2010/07/19 12:54:26 Possible solution: 1. Change Chrome locale only, s
+
+ if (customization.get() != NULL) {
+ // Switch to initial locale if specified by customization
+ // and has not been set yet.
+ const std::string current_locale =
+ g_browser_process->local_state()->GetString(prefs::kApplicationLocale);
+ if (current_locale.empty()) {
const std::string locale = customization->initial_locale();
if (!locale.empty()) {
chromeos::LanguageSwitchMenu::SwitchLanguage(locale);
}
+ }
- // Set initial timezone if specified by customization.
- const std::string timezone_name = customization->initial_timezone();
- if (!timezone_name.empty()) {
- icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8(timezone_name));
- chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone);
- }
+ // Set initial timezone if specified by customization.
+ const std::string timezone_name = customization->initial_timezone();
+ if (!timezone_name.empty()) {
+ icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
+ icu::UnicodeString::fromUTF8(timezone_name));
+ chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone);
}
}
// Create and show the wizard.
WizardController* controller = new WizardController();
- if (!oobe_complete)
+ if (customization.get() != NULL)
controller->SetCustomization(customization.release());
controller->ShowBackground(screen_bounds);
controller->Init(first_screen_name, screen_bounds);
controller->Show();
- if (chromeos::CrosLibrary::Get()->EnsureLoaded())
- chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady();
}
} // namespace browser

Powered by Google App Engine
This is Rietveld 408576698