Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 99 |
| 100 #if defined(TOOLKIT_GTK) | 100 #if defined(TOOLKIT_GTK) |
| 101 #include "chrome/browser/ui/gtk/gtk_util.h" | 101 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 105 #include "apps/app_launch_for_metro_restart_win.h" | 105 #include "apps/app_launch_for_metro_restart_win.h" |
| 106 #include "base/win/windows_version.h" | 106 #include "base/win/windows_version.h" |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 #if defined(ENABLE_MANAGED_USERS) | |
| 110 #include "chrome/browser/managed_mode/managed_user_service.h" | |
| 111 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | |
| 112 #endif | |
| 113 | |
| 109 using content::ChildProcessSecurityPolicy; | 114 using content::ChildProcessSecurityPolicy; |
| 110 using content::WebContents; | 115 using content::WebContents; |
| 111 using extensions::Extension; | 116 using extensions::Extension; |
| 112 | 117 |
| 113 namespace { | 118 namespace { |
| 114 | 119 |
| 115 // Utility functions ---------------------------------------------------------- | 120 // Utility functions ---------------------------------------------------------- |
| 116 | 121 |
| 117 enum LaunchMode { | 122 enum LaunchMode { |
| 118 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. | 123 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 917 chrome::ShowDefaultBrowserPrompt(profile_, | 922 chrome::ShowDefaultBrowserPrompt(profile_, |
| 918 browser->host_desktop_type()); | 923 browser->host_desktop_type()); |
| 919 } | 924 } |
| 920 } | 925 } |
| 921 } | 926 } |
| 922 } | 927 } |
| 923 | 928 |
| 924 | 929 |
| 925 void StartupBrowserCreatorImpl::AddStartupURLs( | 930 void StartupBrowserCreatorImpl::AddStartupURLs( |
| 926 std::vector<GURL>* startup_urls) const { | 931 std::vector<GURL>* startup_urls) const { |
| 932 #if defined(ENABLE_MANAGED_USERS) | |
| 927 PrefService* prefs = profile_->GetPrefs(); | 933 PrefService* prefs = profile_->GetPrefs(); |
| 928 bool has_reset_local_passphrase_switch = | 934 bool has_reset_local_passphrase_switch = |
| 929 command_line_.HasSwitch(switches::kResetLocalPassphrase); | 935 command_line_.HasSwitch(switches::kResetLocalPassphrase); |
| 936 LOG(INFO) << is_first_run_; | |
|
Bernhard Bauer
2013/04/10 09:30:03
Remove logging.
Adrian Kuegel
2013/04/10 09:47:01
Done.
| |
| 930 if ((is_first_run_ || has_reset_local_passphrase_switch) && | 937 if ((is_first_run_ || has_reset_local_passphrase_switch) && |
| 931 prefs->GetBoolean(prefs::kProfileIsManaged)) { | 938 prefs->GetBoolean(prefs::kProfileIsManaged)) { |
| 932 startup_urls->insert(startup_urls->begin(), | 939 startup_urls->insert(startup_urls->begin(), |
| 933 GURL(std::string(chrome::kChromeUISettingsURL) + | 940 GURL(std::string(chrome::kChromeUISettingsURL) + |
| 934 chrome::kManagedUserSettingsSubPage)); | 941 chrome::kManagedUserSettingsSubPage)); |
| 942 ManagedUserServiceFactory::GetForProfile( | |
| 943 profile_)->set_startup_elevation(true); | |
|
Bernhard Bauer
2013/04/10 09:30:03
This looks kinda ugly. Can you extract the Managed
Adrian Kuegel
2013/04/10 09:47:01
Done.
| |
| 935 if (has_reset_local_passphrase_switch) { | 944 if (has_reset_local_passphrase_switch) { |
| 936 prefs->SetString(prefs::kManagedModeLocalPassphrase, std::string()); | 945 prefs->SetString(prefs::kManagedModeLocalPassphrase, std::string()); |
| 937 prefs->SetString(prefs::kManagedModeLocalSalt, std::string()); | 946 prefs->SetString(prefs::kManagedModeLocalSalt, std::string()); |
| 938 } | 947 } |
| 939 } | 948 } |
| 949 #endif | |
| 940 | 950 |
| 941 // If we have urls specified by the first run master preferences use them | 951 // If we have urls specified by the first run master preferences use them |
| 942 // and nothing else. | 952 // and nothing else. |
| 943 if (browser_creator_ && startup_urls->empty()) { | 953 if (browser_creator_ && startup_urls->empty()) { |
| 944 if (!browser_creator_->first_run_tabs_.empty()) { | 954 if (!browser_creator_->first_run_tabs_.empty()) { |
| 945 std::vector<GURL>::iterator it = | 955 std::vector<GURL>::iterator it = |
| 946 browser_creator_->first_run_tabs_.begin(); | 956 browser_creator_->first_run_tabs_.begin(); |
| 947 while (it != browser_creator_->first_run_tabs_.end()) { | 957 while (it != browser_creator_->first_run_tabs_.end()) { |
| 948 // Replace magic names for the actual urls. | 958 // Replace magic names for the actual urls. |
| 949 if (it->host() == "new_tab_page") { | 959 if (it->host() == "new_tab_page") { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 970 } | 980 } |
| 971 | 981 |
| 972 #if !defined(OS_WIN) || defined(USE_AURA) | 982 #if !defined(OS_WIN) || defined(USE_AURA) |
| 973 // static | 983 // static |
| 974 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( | 984 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( |
| 975 Profile* profile, | 985 Profile* profile, |
| 976 const std::vector<GURL>& startup_urls) { | 986 const std::vector<GURL>& startup_urls) { |
| 977 return false; | 987 return false; |
| 978 } | 988 } |
| 979 #endif | 989 #endif |
| OLD | NEW |