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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 #include "content/public/common/page_zoom.h" | 102 #include "content/public/common/page_zoom.h" |
103 #include "ui/base/l10n/l10n_util.h" | 103 #include "ui/base/l10n/l10n_util.h" |
104 | 104 |
105 #if defined(OS_ANDROID) | 105 #if defined(OS_ANDROID) |
106 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 106 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
107 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" | 107 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" |
108 #endif | 108 #endif |
109 | 109 |
110 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
111 #include "chrome/browser/chromeos/locale_change_guard.h" | 111 #include "chrome/browser/chromeos/locale_change_guard.h" |
112 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
112 #include "chrome/browser/chromeos/preferences.h" | 113 #include "chrome/browser/chromeos/preferences.h" |
113 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 114 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
114 #include "components/user_manager/user_manager.h" | 115 #include "components/user_manager/user_manager.h" |
115 #endif | 116 #endif |
116 | 117 |
117 #if defined(ENABLE_BACKGROUND) | 118 #if defined(ENABLE_BACKGROUND) |
118 #include "chrome/browser/background/background_mode_manager.h" | 119 #include "chrome/browser/background/background_mode_manager.h" |
119 #endif | 120 #endif |
120 | 121 |
121 #if defined(ENABLE_CONFIGURATION_POLICY) | 122 #if defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 using content::BrowserThread; | 158 using content::BrowserThread; |
158 using content::DownloadManagerDelegate; | 159 using content::DownloadManagerDelegate; |
159 | 160 |
160 namespace { | 161 namespace { |
161 | 162 |
162 #if defined(ENABLE_SESSION_SERVICE) | 163 #if defined(ENABLE_SESSION_SERVICE) |
163 // Delay, in milliseconds, before we explicitly create the SessionService. | 164 // Delay, in milliseconds, before we explicitly create the SessionService. |
164 const int kCreateSessionServiceDelayMS = 500; | 165 const int kCreateSessionServiceDelayMS = 500; |
165 #endif | 166 #endif |
166 | 167 |
168 #if defined(OS_CHROMEOS) | |
169 // ChromeOS Goodies page for device's first New Window. | |
170 const char kOOBEGoodiesURL[] = | |
171 "https://www.google.com/chrome/devices/goodies.html"; | |
172 #endif | |
173 | |
167 // Text content of README file created in each profile directory. Both %s | 174 // Text content of README file created in each profile directory. Both %s |
168 // placeholders must contain the product name. This is not localizable and hence | 175 // placeholders must contain the product name. This is not localizable and hence |
169 // not in resources. | 176 // not in resources. |
170 const char kReadmeText[] = | 177 const char kReadmeText[] = |
171 "%s settings and storage represent user-selected preferences and " | 178 "%s settings and storage represent user-selected preferences and " |
172 "information and MUST not be extracted, overwritten or modified except " | 179 "information and MUST not be extracted, overwritten or modified except " |
173 "through %s defined APIs."; | 180 "through %s defined APIs."; |
174 | 181 |
175 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED. | 182 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED. |
176 const char kPrefExitTypeCrashed[] = "Crashed"; | 183 const char kPrefExitTypeCrashed[] = "Crashed"; |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1207 | 1214 |
1208 if (GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 1215 if (GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
1209 return GURL(chrome::kChromeUINewTabURL); | 1216 return GURL(chrome::kChromeUINewTabURL); |
1210 GURL home_page(url_formatter::FixupURL( | 1217 GURL home_page(url_formatter::FixupURL( |
1211 GetPrefs()->GetString(prefs::kHomePage), std::string())); | 1218 GetPrefs()->GetString(prefs::kHomePage), std::string())); |
1212 if (!home_page.is_valid()) | 1219 if (!home_page.is_valid()) |
1213 return GURL(chrome::kChromeUINewTabURL); | 1220 return GURL(chrome::kChromeUINewTabURL); |
1214 return home_page; | 1221 return home_page; |
1215 } | 1222 } |
1216 | 1223 |
1224 // If conditions enumerated below are met, returns the Oobe Goodies URL for new | |
1225 // Chromebooks, and uses pref to mark page as shown. | |
1226 GURL ProfileImpl::ShowingGoodiesPageInNewWindow() { | |
Greg Levin
2015/09/09 23:20:33
This logic could probably go somewhere other than
anthonyvd
2015/09/14 13:59:35
Agreed. Since it's not a profile-specific pref I w
Greg Levin
2015/09/15 00:12:11
Done (Moved all code into new file / class).
| |
1227 // 1. Only show on ChromeOS. | |
1228 #if defined(OS_CHROMEOS) | |
1229 PrefService* local_state = g_browser_process->local_state(); | |
1230 DCHECK(local_state); | |
1231 // 2. Not previously shown, or otherwise marked as unavailable. | |
1232 if (local_state->GetBoolean(prefs::kCanShowOobeGoodiesPage)) { | |
1233 // 3. Device not enterprise enrolled. | |
1234 if (g_browser_process->platform_part() | |
1235 ->browser_policy_connector_chromeos() | |
1236 ->IsEnterpriseManaged()) { | |
1237 // If it is, no need to ever check again. | |
1238 local_state->SetBoolean(prefs::kCanShowOobeGoodiesPage, false); | |
1239 } else { | |
1240 // (4. Not guest session, or incognito: these both use | |
1241 // OffTheRecordProfileImpl, not ProfileImpl.) | |
1242 // (5. Not new tab: New tab code doesn't call this function.) | |
1243 local_state->SetBoolean(prefs::kCanShowOobeGoodiesPage, false); | |
1244 return GURL(kOOBEGoodiesURL); | |
1245 } | |
1246 } | |
1247 #endif | |
1248 return GURL(); | |
1249 } | |
1250 | |
1217 void ProfileImpl::UpdateProfileSupervisedUserIdCache() { | 1251 void ProfileImpl::UpdateProfileSupervisedUserIdCache() { |
1218 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1252 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1219 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1253 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1220 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1254 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1221 if (index != std::string::npos) { | 1255 if (index != std::string::npos) { |
1222 std::string supervised_user_id = | 1256 std::string supervised_user_id = |
1223 GetPrefs()->GetString(prefs::kSupervisedUserId); | 1257 GetPrefs()->GetString(prefs::kSupervisedUserId); |
1224 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id); | 1258 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id); |
1225 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); | 1259 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); |
1226 } | 1260 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1333 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1300 domain_reliability::DomainReliabilityService* service = | 1334 domain_reliability::DomainReliabilityService* service = |
1301 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1335 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1302 GetForBrowserContext(this); | 1336 GetForBrowserContext(this); |
1303 if (!service) | 1337 if (!service) |
1304 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1338 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1305 | 1339 |
1306 return service->CreateMonitor( | 1340 return service->CreateMonitor( |
1307 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1341 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
1308 } | 1342 } |
OLD | NEW |