| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 704 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 705 return host_->GetNativeWindow(); | 705 return host_->GetNativeWindow(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void ExistingUserController::InitializeStartUrls() const { | 708 void ExistingUserController::InitializeStartUrls() const { |
| 709 std::vector<std::string> start_urls; | 709 std::vector<std::string> start_urls; |
| 710 PrefService* prefs = g_browser_process->local_state(); | 710 PrefService* prefs = g_browser_process->local_state(); |
| 711 const std::string current_locale = | 711 const std::string current_locale = |
| 712 StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); | 712 StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); |
| 713 std::string start_url; | 713 std::string start_url; |
| 714 if (prefs->GetBoolean(prefs::kSpokenFeedbackEnabled)) { | 714 const base::ListValue *urls; |
| 715 const char* url = kChromeVoxTutorialURLPattern; | 715 if (UserManager::Get()->IsLoggedInAsDemoUser() && |
| 716 start_url = base::StringPrintf(url, current_locale.c_str()); | 716 CrosSettings::Get()->GetList(kStartUpUrls, &urls)) { |
| 717 // the demo user will get its start urls from the special policy if it is |
| 718 // set. |
| 719 for (base::ListValue::const_iterator it = urls->begin(); |
| 720 it != urls->end(); ++it) { |
| 721 std::string url; |
| 722 if ((*it)->GetAsString(&url)) |
| 723 start_urls.push_back(url); |
| 724 } |
| 717 } else { | 725 } else { |
| 718 const char* url = kGetStartedURLPattern; | 726 if (prefs->GetBoolean(prefs::kSpokenFeedbackEnabled)) { |
| 719 start_url = base::StringPrintf(url, current_locale.c_str()); | 727 const char* url = kChromeVoxTutorialURLPattern; |
| 720 std::string params_str; | 728 start_url = base::StringPrintf(url, current_locale.c_str()); |
| 729 } else { |
| 730 const char* url = kGetStartedURLPattern; |
| 731 start_url = base::StringPrintf(url, current_locale.c_str()); |
| 732 std::string params_str; |
| 721 #if 0 | 733 #if 0 |
| 722 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; | 734 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; |
| 723 std::string board; | 735 std::string board; |
| 724 system::StatisticsProvider* provider = | 736 system::StatisticsProvider* provider = |
| 725 system::StatisticsProvider::GetInstance(); | 737 system::StatisticsProvider::GetInstance(); |
| 726 if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) | 738 if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) |
| 727 LOG(ERROR) << "Failed to get board information"; | 739 LOG(ERROR) << "Failed to get board information"; |
| 728 if (!board.empty()) { | 740 if (!board.empty()) { |
| 729 params_str.append(base::StringPrintf(kGetStartedBoardParam, | 741 params_str.append(base::StringPrintf(kGetStartedBoardParam, |
| 730 board.c_str())); | 742 board.c_str())); |
| 743 } |
| 744 #endif |
| 745 if (is_owner_login_) |
| 746 params_str.append(kGetStartedOwnerParam); |
| 747 if (!params_str.empty()) { |
| 748 params_str.insert(0, kGetStartedParamsStartMark); |
| 749 start_url.append(params_str); |
| 750 } |
| 731 } | 751 } |
| 732 #endif | 752 start_urls.push_back(start_url); |
| 733 if (is_owner_login_) | |
| 734 params_str.append(kGetStartedOwnerParam); | |
| 735 if (!params_str.empty()) { | |
| 736 params_str.insert(0, kGetStartedParamsStartMark); | |
| 737 start_url.append(params_str); | |
| 738 } | |
| 739 } | 753 } |
| 740 start_urls.push_back(start_url); | |
| 741 | 754 |
| 742 ServicesCustomizationDocument* customization = | 755 ServicesCustomizationDocument* customization = |
| 743 ServicesCustomizationDocument::GetInstance(); | 756 ServicesCustomizationDocument::GetInstance(); |
| 744 if (!ServicesCustomizationDocument::WasApplied() && | 757 if (!ServicesCustomizationDocument::WasApplied() && |
| 745 customization->IsReady()) { | 758 customization->IsReady()) { |
| 746 std::string locale = g_browser_process->GetApplicationLocale(); | 759 std::string locale = g_browser_process->GetApplicationLocale(); |
| 747 std::string initial_start_page = | 760 std::string initial_start_page = |
| 748 customization->GetInitialStartPage(locale); | 761 customization->GetInitialStartPage(locale); |
| 749 if (!initial_start_page.empty()) | 762 if (!initial_start_page.empty()) |
| 750 start_urls.push_back(initial_start_page); | 763 start_urls.push_back(initial_start_page); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 // changed. | 808 // changed. |
| 796 UserManager::Get()->SaveUserOAuthStatus(username, | 809 UserManager::Get()->SaveUserOAuthStatus(username, |
| 797 User::OAUTH_TOKEN_STATUS_INVALID); | 810 User::OAUTH_TOKEN_STATUS_INVALID); |
| 798 | 811 |
| 799 login_display_->SetUIEnabled(true); | 812 login_display_->SetUIEnabled(true); |
| 800 SetStatusAreaEnabled(true); | 813 SetStatusAreaEnabled(true); |
| 801 login_display_->ShowGaiaPasswordChanged(username); | 814 login_display_->ShowGaiaPasswordChanged(username); |
| 802 } | 815 } |
| 803 | 816 |
| 804 } // namespace chromeos | 817 } // namespace chromeos |
| OLD | NEW |