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