Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl.cc |
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
| index dc1d34549376c14c689d37e72c0ab62b48a99a88..46bd8353db5b5bdcb8405da24a54b96ce9341e83 100644 |
| --- a/chrome/browser/profiles/profile_impl.cc |
| +++ b/chrome/browser/profiles/profile_impl.cc |
| @@ -109,6 +109,7 @@ |
| #if defined(OS_CHROMEOS) |
| #include "chrome/browser/chromeos/locale_change_guard.h" |
| +#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| #include "chrome/browser/chromeos/preferences.h" |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "components/user_manager/user_manager.h" |
| @@ -164,6 +165,12 @@ namespace { |
| const int kCreateSessionServiceDelayMS = 500; |
| #endif |
| +#if defined(OS_CHROMEOS) |
| +// ChromeOS Goodies page for device's first New Window. |
| +const char kOOBEGoodiesURL[] = |
| + "https://www.google.com/chrome/devices/goodies.html"; |
| +#endif |
| + |
| // Text content of README file created in each profile directory. Both %s |
| // placeholders must contain the product name. This is not localizable and hence |
| // not in resources. |
| @@ -1214,6 +1221,33 @@ GURL ProfileImpl::GetHomePage() { |
| return home_page; |
| } |
| +// If conditions enumerated below are met, returns the Oobe Goodies URL for new |
| +// Chromebooks, and uses pref to mark page as shown. |
| +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).
|
| +// 1. Only show on ChromeOS. |
| +#if defined(OS_CHROMEOS) |
| + PrefService* local_state = g_browser_process->local_state(); |
| + DCHECK(local_state); |
| + // 2. Not previously shown, or otherwise marked as unavailable. |
| + if (local_state->GetBoolean(prefs::kCanShowOobeGoodiesPage)) { |
| + // 3. Device not enterprise enrolled. |
| + if (g_browser_process->platform_part() |
| + ->browser_policy_connector_chromeos() |
| + ->IsEnterpriseManaged()) { |
| + // If it is, no need to ever check again. |
| + local_state->SetBoolean(prefs::kCanShowOobeGoodiesPage, false); |
| + } else { |
| + // (4. Not guest session, or incognito: these both use |
| + // OffTheRecordProfileImpl, not ProfileImpl.) |
| + // (5. Not new tab: New tab code doesn't call this function.) |
| + local_state->SetBoolean(prefs::kCanShowOobeGoodiesPage, false); |
| + return GURL(kOOBEGoodiesURL); |
| + } |
| + } |
| +#endif |
| + return GURL(); |
| +} |
| + |
| void ProfileImpl::UpdateProfileSupervisedUserIdCache() { |
| ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |