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

Side by Side Diff: chrome/browser/chromeos/login/startup_utils.cc

Issue 2890843002: Policy implementation for encryptfs to ext4 migration strategy (Closed)
Patch Set: Implementation Created 3 years, 6 months 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
OLDNEW
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/chromeos/login/startup_utils.h" 5 #include "chrome/browser/chromeos/login/startup_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/sys_info.h" 11 #include "base/sys_info.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
15 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
16 #include "chrome/browser/chromeos/settings/device_settings_service.h"
15 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
17 #include "chromeos/chromeos_switches.h" 19 #include "chromeos/chromeos_switches.h"
20 #include "components/arc/arc_util.h"
18 #include "components/prefs/pref_registry_simple.h" 21 #include "components/prefs/pref_registry_simple.h"
19 #include "components/prefs/pref_service.h" 22 #include "components/prefs/pref_service.h"
20 #include "components/web_resource/web_resource_pref_names.h" 23 #include "components/web_resource/web_resource_pref_names.h"
21 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
22 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
23 26
24 using content::BrowserThread; 27 using content::BrowserThread;
25 28
26 namespace { 29 namespace {
27 30
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 prefs->CommitPendingWrite(); 224 prefs->CommitPendingWrite();
222 } 225 }
223 226
224 // static 227 // static
225 base::Time StartupUtils::GetTimeOfLastUpdateCheckWithoutUpdate() { 228 base::Time StartupUtils::GetTimeOfLastUpdateCheckWithoutUpdate() {
226 return base::Time::FromInternalValue( 229 return base::Time::FromInternalValue(
227 g_browser_process->local_state()->GetInt64( 230 g_browser_process->local_state()->GetInt64(
228 prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate)); 231 prefs::kOobeTimeOfLastUpdateCheckWithoutUpdate));
229 } 232 }
230 233
234 // static
235 void StartupUtils::SetExt4MigrationForArcAllowed() {
hidehiko 2017/05/25 12:41:55 Calling this function in various places sounds not
igorcov 2017/05/31 17:25:35 You are right, that's a good point. I've changed t
236 // If the policy was set already, exit. For migration after policy update, a
237 // restart is needed.
238 if (arc::GetArcAvailabilityPolicyStatus() !=
239 arc::ARC_AVAILABILITY_POLICY_STATUS::UNKNOWN)
240 return;
241
242 policy::BrowserPolicyConnectorChromeOS* connector =
243 g_browser_process->platform_part()->browser_policy_connector_chromeos();
244 if (!connector->IsEnterpriseManaged()) {
245 arc::SetArcAvailabilityPolicyStatus(
246 arc::ARC_AVAILABILITY_POLICY_STATUS::AVAILABLE);
247 return;
248 }
249
250 const enterprise_management::ChromeDeviceSettingsProto* policy =
hidehiko 2017/05/25 12:41:55 nit: auto help to shorten the code. Something like
251 chromeos::DeviceSettingsService::Get()->device_settings();
252 if (policy && policy->has_device_ecryptfs_migration_strategy()) {
253 const enterprise_management::DeviceEcryptfsMigrationStrategyProto&
254 container(policy->device_ecryptfs_migration_strategy());
255 if (container.has_migration_strategy() &&
256 container.migration_strategy() ==
257 enterprise_management::DeviceEcryptfsMigrationStrategyProto::
258 ALLOW_MIGRATION) {
259 arc::SetArcAvailabilityPolicyStatus(
260 arc::ARC_AVAILABILITY_POLICY_STATUS::AVAILABLE);
261 } else {
262 arc::SetArcAvailabilityPolicyStatus(
263 arc::ARC_AVAILABILITY_POLICY_STATUS::DISABLED);
264 }
265 }
hidehiko 2017/05/25 12:41:55 What value should be assigned in case of no proto?
igorcov 2017/05/31 17:25:35 The function is called a few times before the poli
266 }
267
231 } // namespace chromeos 268 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698