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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 8713017: Open the RestoreOnStartupURLs on first login, if specified by the admin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/policy/configuration_policy_handler_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <vector>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/message_loop.h" 13 #include "base/message_loop.h"
12 #include "base/string_util.h" 14 #include "base/string_util.h"
13 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 17 #include "base/values.h"
16 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chromeos/boot_times_loader.h" 19 #include "chrome/browser/chromeos/boot_times_loader.h"
18 #include "chrome/browser/chromeos/cros_settings.h" 20 #include "chrome/browser/chromeos/cros_settings.h"
19 #include "chrome/browser/chromeos/cros/cros_library.h" 21 #include "chrome/browser/chromeos/cros/cros_library.h"
20 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 22 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
21 #include "chrome/browser/chromeos/cros/network_library.h" 23 #include "chrome/browser/chromeos/cros/network_library.h"
22 #include "chrome/browser/chromeos/customization_document.h" 24 #include "chrome/browser/chromeos/customization_document.h"
23 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 25 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
24 #include "chrome/browser/chromeos/dbus/session_manager_client.h" 26 #include "chrome/browser/chromeos/dbus/session_manager_client.h"
25 #include "chrome/browser/chromeos/login/helper.h" 27 #include "chrome/browser/chromeos/login/helper.h"
26 #include "chrome/browser/chromeos/login/login_display_host.h" 28 #include "chrome/browser/chromeos/login/login_display_host.h"
27 #include "chrome/browser/chromeos/login/user_manager.h" 29 #include "chrome/browser/chromeos/login/user_manager.h"
28 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" 30 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
29 #include "chrome/browser/chromeos/login/wizard_controller.h" 31 #include "chrome/browser/chromeos/login/wizard_controller.h"
30 #include "chrome/browser/google/google_util.h" 32 #include "chrome/browser/google/google_util.h"
31 #include "chrome/browser/prefs/pref_service.h" 33 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/browser/prefs/session_startup_pref.h"
32 #include "chrome/browser/profiles/profile_manager.h" 35 #include "chrome/browser/profiles/profile_manager.h"
33 #include "chrome/browser/ui/dialog_style.h" 36 #include "chrome/browser/ui/dialog_style.h"
34 #include "chrome/browser/ui/views/window.h" 37 #include "chrome/browser/ui/views/window.h"
35 #include "chrome/common/chrome_notification_types.h" 38 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
37 #include "chrome/common/net/gaia/google_service_auth_error.h" 40 #include "chrome/common/net/gaia/google_service_auth_error.h"
38 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
39 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
40 #include "content/public/browser/notification_types.h" 43 #include "content/public/browser/notification_types.h"
41 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 403
401 404
402 // Notifiy LoginDisplay to allow it provide visual feedback to user. 405 // Notifiy LoginDisplay to allow it provide visual feedback to user.
403 login_display_->OnLoginSuccess(username); 406 login_display_->OnLoginSuccess(username);
404 } 407 }
405 408
406 void ExistingUserController::OnProfilePrepared(Profile* profile) { 409 void ExistingUserController::OnProfilePrepared(Profile* profile) {
407 // TODO(nkostylev): May add login UI implementation callback call. 410 // TODO(nkostylev): May add login UI implementation callback call.
408 if (!ready_for_browser_launch_) { 411 if (!ready_for_browser_launch_) {
409 // Add the appropriate first-login URL. 412 // Add the appropriate first-login URL.
413 std::vector<std::string> start_urls;
410 PrefService* prefs = g_browser_process->local_state(); 414 PrefService* prefs = g_browser_process->local_state();
411 const std::string current_locale = 415 const std::string current_locale =
412 StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); 416 StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale));
413 std::string start_url; 417 std::string start_url;
414 if (prefs->GetBoolean(prefs::kAccessibilityEnabled) && 418 if (prefs->GetBoolean(prefs::kAccessibilityEnabled) &&
415 current_locale.find("en") != std::string::npos) { 419 current_locale.find("en") != std::string::npos) {
416 start_url = kChromeVoxTutorialURL; 420 start_url = kChromeVoxTutorialURL;
417 } else { 421 } else {
418 const char* url = kGetStartedURLPattern; 422 const char* url = kGetStartedURLPattern;
419 if (is_owner_login_) 423 if (is_owner_login_)
420 url = kGetStartedOwnerURLPattern; 424 url = kGetStartedOwnerURLPattern;
421 start_url = base::StringPrintf(url, current_locale.c_str()); 425 start_url = base::StringPrintf(url, current_locale.c_str());
422 } 426 }
423 CommandLine::ForCurrentProcess()->AppendArg(start_url); 427 start_urls.push_back(start_url);
424 428
425 ServicesCustomizationDocument* customization = 429 ServicesCustomizationDocument* customization =
426 ServicesCustomizationDocument::GetInstance(); 430 ServicesCustomizationDocument::GetInstance();
427 if (!ServicesCustomizationDocument::WasApplied() && 431 if (!ServicesCustomizationDocument::WasApplied() &&
428 customization->IsReady()) { 432 customization->IsReady()) {
429 std::string locale = g_browser_process->GetApplicationLocale(); 433 std::string locale = g_browser_process->GetApplicationLocale();
430 std::string initial_start_page = 434 std::string initial_start_page =
431 customization->GetInitialStartPage(locale); 435 customization->GetInitialStartPage(locale);
432 if (!initial_start_page.empty()) 436 if (!initial_start_page.empty())
433 CommandLine::ForCurrentProcess()->AppendArg(initial_start_page); 437 start_urls.push_back(initial_start_page);
434 customization->ApplyCustomization(); 438 customization->ApplyCustomization();
435 } 439 }
436 440
437 if (two_factor_credentials_) { 441 if (two_factor_credentials_) {
438 // If we have a two factor error and and this is a new user, 442 // If we have a two factor error and and this is a new user,
439 // load the personal settings page. 443 // load the personal settings page.
440 // TODO(stevenjb): direct the user to a lightweight sync login page. 444 // TODO(stevenjb): direct the user to a lightweight sync login page.
441 CommandLine::ForCurrentProcess()->AppendArg(kSettingsSyncLoginURL); 445 start_urls.push_back(kSettingsSyncLoginURL);
442 } 446 }
443 447
448 // Don't specify start URLs if the administrator has configured the start
449 // URLs via policy.
450 if (!SessionStartupPref::TypeIsManaged(profile->GetPrefs())) {
451 for (size_t i = 0; i < start_urls.size(); ++i)
452 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]);
453 }
444 #ifndef NDEBUG 454 #ifndef NDEBUG
445 if (CommandLine::ForCurrentProcess()->HasSwitch( 455 if (CommandLine::ForCurrentProcess()->HasSwitch(
446 switches::kOobeSkipPostLogin)) { 456 switches::kOobeSkipPostLogin)) {
447 ready_for_browser_launch_ = true; 457 ready_for_browser_launch_ = true;
448 LoginUtils::DoBrowserLaunch(profile, host_); 458 LoginUtils::DoBrowserLaunch(profile, host_);
449 host_ = NULL; 459 host_ = NULL;
450 } else { 460 } else {
451 #endif 461 #endif
452 ActivateWizard(WizardController::IsDeviceRegistered() ? 462 ActivateWizard(WizardController::IsDeviceRegistered() ?
453 WizardController::kUserImageScreenName : 463 WizardController::kUserImageScreenName :
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 std::string owner; 619 std::string owner;
610 cros_settings_->GetString(kDeviceOwner, &owner); 620 cros_settings_->GetString(kDeviceOwner, &owner);
611 cryptohomed->AsyncSetOwnerUser(owner, NULL); 621 cryptohomed->AsyncSetOwnerUser(owner, NULL);
612 622
613 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here 623 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here
614 // so it does not delay the following mount. Cleanup will be 624 // so it does not delay the following mount. Cleanup will be
615 // started in Cryptohomed by timer. 625 // started in Cryptohomed by timer.
616 } 626 }
617 627
618 } // namespace chromeos 628 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/configuration_policy_handler_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698