Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/chromeos/first_run/goodies_displayer.cc

Issue 2558103002: No Goodies for Supervised Users (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/first_run/goodies_displayer.h" 5 #include "chrome/browser/chromeos/first_run/goodies_displayer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/login/startup_utils.h" 12 #include "chrome/browser/chromeos/login/startup_utils.h"
13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
21 #include "components/user_manager/user.h"
22 #include "components/user_manager/user_manager.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 24
23 namespace chromeos { 25 namespace chromeos {
24 namespace first_run { 26 namespace first_run {
25 27
26 namespace { 28 namespace {
27 29
28 GoodiesDisplayer* g_goodies_displayer = nullptr; 30 GoodiesDisplayer* g_goodies_displayer = nullptr;
29 GoodiesDisplayerTestInfo* g_test_info = nullptr; 31 GoodiesDisplayerTestInfo* g_test_info = nullptr;
30 32
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // static 101 // static
100 void GoodiesDisplayer::Delete() { 102 void GoodiesDisplayer::Delete() {
101 delete g_goodies_displayer; 103 delete g_goodies_displayer;
102 g_goodies_displayer = nullptr; 104 g_goodies_displayer = nullptr;
103 } 105 }
104 106
105 // If conditions enumerated below are met, this loads the Oobe Goodies page for 107 // If conditions enumerated below are met, this loads the Oobe Goodies page for
106 // new Chromebooks; when appropriate, it uses pref to mark page as shown, 108 // new Chromebooks; when appropriate, it uses pref to mark page as shown,
107 // removes itself from BrowserListObservers, and deletes itself. 109 // removes itself from BrowserListObservers, and deletes itself.
108 void GoodiesDisplayer::OnBrowserSetLastActive(Browser* browser) { 110 void GoodiesDisplayer::OnBrowserSetLastActive(Browser* browser) {
109 // 1. Must be an actual tabbed brower window. 111 // 1. Must be an actual tabbed browser window.
110 if (browser->type() != Browser::TYPE_TABBED) 112 if (browser->type() != Browser::TYPE_TABBED)
111 return; 113 return;
112 114
113 // 2. Not guest or incognito session (keep observing). 115 // 2. Not guest or incognito session or supervised user (keep observing).
114 if (browser->profile()->IsOffTheRecord()) 116 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser();
117 if (browser->profile()->IsOffTheRecord() || (user && user->IsSupervised()))
115 return; 118 return;
116 119
117 PrefService* local_state = g_browser_process->local_state(); 120 PrefService* local_state = g_browser_process->local_state();
118 // 3. Not previously shown, or otherwise marked as unavailable. 121 // 3. Not previously shown, or otherwise marked as unavailable.
119 if (local_state->GetBoolean(prefs::kCanShowOobeGoodiesPage)) { 122 if (local_state->GetBoolean(prefs::kCanShowOobeGoodiesPage)) {
120 // 4. Device not enterprise enrolled. 123 // 4. Device not enterprise enrolled.
121 const bool enterprise_managed = g_browser_process->platform_part() 124 const bool enterprise_managed = g_browser_process->platform_part()
122 ->browser_policy_connector_chromeos() 125 ->browser_policy_connector_chromeos()
123 ->IsEnterpriseManaged(); 126 ->IsEnterpriseManaged();
124 // 5. --no-first-run not specified, as it is for tests. --force-run takes 127 // 5. --no-first-run not specified, as it is for tests. --force-run takes
(...skipping 14 matching lines...) Expand all
139 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(&Delete)); 142 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(&Delete));
140 } 143 }
141 144
142 GoodiesDisplayerTestInfo::GoodiesDisplayerTestInfo() 145 GoodiesDisplayerTestInfo::GoodiesDisplayerTestInfo()
143 : days_since_oobe(0), setup_complete(false) {} 146 : days_since_oobe(0), setup_complete(false) {}
144 147
145 GoodiesDisplayerTestInfo::~GoodiesDisplayerTestInfo() {} 148 GoodiesDisplayerTestInfo::~GoodiesDisplayerTestInfo() {}
146 149
147 } // namespace first_run 150 } // namespace first_run
148 } // namespace chromeos 151 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698