Open the RestoreOnStartupURLs on first login, if specified by the admin.

This makes sure the user gets what the admin configured instead of the Welcome
pages, on first login.

BUG=chromium-os:23463
TEST=First login on an enterprise ChromeOS device (with a managed user of the same domain) won't show the Welcome pages when the admin has specified Startup URLs for the user.


Review URL: http://codereview.chromium.org/8713017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112733 0039d316-1c4b-4281-b951-d872f2087c98
parent c7791877
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/existing_user_controller.h"
#include <vector>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/dialog_style.h" #include "chrome/browser/ui/dialog_style.h"
#include "chrome/browser/ui/views/window.h" #include "chrome/browser/ui/views/window.h"
...@@ -407,6 +410,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -407,6 +410,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
// TODO(nkostylev): May add login UI implementation callback call. // TODO(nkostylev): May add login UI implementation callback call.
if (!ready_for_browser_launch_) { if (!ready_for_browser_launch_) {
// Add the appropriate first-login URL. // Add the appropriate first-login URL.
std::vector<std::string> start_urls;
PrefService* prefs = g_browser_process->local_state(); PrefService* prefs = g_browser_process->local_state();
const std::string current_locale = const std::string current_locale =
StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale));
...@@ -420,7 +424,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -420,7 +424,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
url = kGetStartedOwnerURLPattern; url = kGetStartedOwnerURLPattern;
start_url = base::StringPrintf(url, current_locale.c_str()); start_url = base::StringPrintf(url, current_locale.c_str());
} }
CommandLine::ForCurrentProcess()->AppendArg(start_url); start_urls.push_back(start_url);
ServicesCustomizationDocument* customization = ServicesCustomizationDocument* customization =
ServicesCustomizationDocument::GetInstance(); ServicesCustomizationDocument::GetInstance();
...@@ -430,7 +434,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -430,7 +434,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
std::string initial_start_page = std::string initial_start_page =
customization->GetInitialStartPage(locale); customization->GetInitialStartPage(locale);
if (!initial_start_page.empty()) if (!initial_start_page.empty())
CommandLine::ForCurrentProcess()->AppendArg(initial_start_page); start_urls.push_back(initial_start_page);
customization->ApplyCustomization(); customization->ApplyCustomization();
} }
...@@ -438,9 +442,15 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -438,9 +442,15 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
// If we have a two factor error and and this is a new user, // If we have a two factor error and and this is a new user,
// load the personal settings page. // load the personal settings page.
// TODO(stevenjb): direct the user to a lightweight sync login page. // TODO(stevenjb): direct the user to a lightweight sync login page.
CommandLine::ForCurrentProcess()->AppendArg(kSettingsSyncLoginURL); start_urls.push_back(kSettingsSyncLoginURL);
} }
// Don't specify start URLs if the administrator has configured the start
// URLs via policy.
if (!SessionStartupPref::TypeIsManaged(profile->GetPrefs())) {
for (size_t i = 0; i < start_urls.size(); ++i)
CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]);
}
#ifndef NDEBUG #ifndef NDEBUG
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kOobeSkipPostLogin)) { switches::kOobeSkipPostLogin)) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/policy/configuration_policy_handler_chromeos.h" #include "chrome/browser/policy/configuration_policy_handler_chromeos.h"
#endif #endif // defined(OS_CHROMEOS)
namespace policy { namespace policy {
...@@ -198,7 +198,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { ...@@ -198,7 +198,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
prefs::kEnableScreenLock }, prefs::kEnableScreenLock },
{ Value::TYPE_STRING, kPolicyChromeOsReleaseChannel, { Value::TYPE_STRING, kPolicyChromeOsReleaseChannel,
prefs::kChromeOsReleaseChannel }, prefs::kChromeOsReleaseChannel },
#endif #endif // defined(OS_CHROMEOS)
}; };
} // namespace } // namespace
...@@ -222,7 +222,7 @@ ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { ...@@ -222,7 +222,7 @@ ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
handlers_.push_back(new DownloadDirPolicyHandler()); handlers_.push_back(new DownloadDirPolicyHandler());
#endif // !defined(OS_CHROME0S) #endif // !defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
handlers_.push_back( handlers_.push_back(
...@@ -231,7 +231,7 @@ ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { ...@@ -231,7 +231,7 @@ ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() {
handlers_.push_back( handlers_.push_back(
new NetworkConfigurationPolicyHandler( new NetworkConfigurationPolicyHandler(
kPolicyOpenNetworkConfiguration)); kPolicyOpenNetworkConfiguration));
#endif #endif // defined(OS_CHROMEOS)
} }
ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment