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/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 chrome::ShowDefaultBrowserPrompt(profile_, | 917 chrome::ShowDefaultBrowserPrompt(profile_, |
918 browser->host_desktop_type()); | 918 browser->host_desktop_type()); |
919 } | 919 } |
920 } | 920 } |
921 } | 921 } |
922 } | 922 } |
923 | 923 |
924 | 924 |
925 void StartupBrowserCreatorImpl::AddStartupURLs( | 925 void StartupBrowserCreatorImpl::AddStartupURLs( |
926 std::vector<GURL>* startup_urls) const { | 926 std::vector<GURL>* startup_urls) const { |
| 927 PrefService* prefs = profile_->GetPrefs(); |
| 928 bool has_reset_local_passphrase_switch = |
| 929 command_line_.HasSwitch(switches::kResetLocalPassphrase); |
| 930 if ((is_first_run_ || has_reset_local_passphrase_switch) && |
| 931 prefs->GetBoolean(prefs::kProfileIsManaged)) { |
| 932 startup_urls->insert(startup_urls->begin(), |
| 933 GURL(std::string(chrome::kChromeUISettingsURL) + |
| 934 chrome::kManagedUserSettingsSubPage)); |
| 935 if (has_reset_local_passphrase_switch) { |
| 936 prefs->SetString(prefs::kManagedModeLocalPassphrase, ""); |
| 937 prefs->SetString(prefs::kManagedModeLocalSalt, ""); |
| 938 } |
| 939 } |
| 940 |
927 // If we have urls specified by the first run master preferences use them | 941 // If we have urls specified by the first run master preferences use them |
928 // and nothing else. | 942 // and nothing else. |
929 if (browser_creator_ && startup_urls->empty()) { | 943 if (browser_creator_ && startup_urls->empty()) { |
930 if (!browser_creator_->first_run_tabs_.empty()) { | 944 if (!browser_creator_->first_run_tabs_.empty()) { |
931 std::vector<GURL>::iterator it = | 945 std::vector<GURL>::iterator it = |
932 browser_creator_->first_run_tabs_.begin(); | 946 browser_creator_->first_run_tabs_.begin(); |
933 while (it != browser_creator_->first_run_tabs_.end()) { | 947 while (it != browser_creator_->first_run_tabs_.end()) { |
934 // Replace magic names for the actual urls. | 948 // Replace magic names for the actual urls. |
935 if (it->host() == "new_tab_page") { | 949 if (it->host() == "new_tab_page") { |
936 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); | 950 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); |
937 } else if (it->host() == "welcome_page") { | 951 } else if (it->host() == "welcome_page") { |
938 startup_urls->push_back(internals::GetWelcomePageURL()); | 952 startup_urls->push_back(internals::GetWelcomePageURL()); |
939 } else { | 953 } else { |
940 startup_urls->push_back(*it); | 954 startup_urls->push_back(*it); |
941 } | 955 } |
942 ++it; | 956 ++it; |
943 } | 957 } |
944 browser_creator_->first_run_tabs_.clear(); | 958 browser_creator_->first_run_tabs_.clear(); |
945 } | 959 } |
946 } | 960 } |
947 | 961 |
948 // Otherwise open at least the new tab page (and the welcome page, if this | 962 // Otherwise open at least the new tab page (and the welcome page, if this |
949 // is the first time the browser is being started), or the set of URLs | 963 // is the first time the browser is being started), or the set of URLs |
950 // specified on the command line. | 964 // specified on the command line. |
951 if (startup_urls->empty()) { | 965 if (startup_urls->empty()) { |
952 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); | 966 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); |
953 if (first_run::ShouldShowWelcomePage()) | 967 if (first_run::ShouldShowWelcomePage()) |
954 startup_urls->push_back(internals::GetWelcomePageURL()); | 968 startup_urls->push_back(internals::GetWelcomePageURL()); |
955 } | 969 } |
956 | |
957 PrefService* prefs = profile_->GetPrefs(); | |
958 bool has_reset_local_passphrase_switch = | |
959 command_line_.HasSwitch(switches::kResetLocalPassphrase); | |
960 if ((is_first_run_ || has_reset_local_passphrase_switch) && | |
961 prefs->GetBoolean(prefs::kProfileIsManaged)) { | |
962 startup_urls->insert(startup_urls->begin(), | |
963 GURL(std::string(chrome::kChromeUISettingsURL) + | |
964 chrome::kManagedUserSettingsSubPage)); | |
965 if (has_reset_local_passphrase_switch) { | |
966 prefs->SetString(prefs::kManagedModeLocalPassphrase, ""); | |
967 prefs->SetString(prefs::kManagedModeLocalSalt, ""); | |
968 } | |
969 } | |
970 } | 970 } |
971 | 971 |
972 #if !defined(OS_WIN) || defined(USE_AURA) | 972 #if !defined(OS_WIN) || defined(USE_AURA) |
973 // static | 973 // static |
974 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( | 974 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( |
975 Profile* profile, | 975 Profile* profile, |
976 const std::vector<GURL>& startup_urls) { | 976 const std::vector<GURL>& startup_urls) { |
977 return false; | 977 return false; |
978 } | 978 } |
979 #endif | 979 #endif |
OLD | NEW |