Commit 82fd48aa authored by Nancy Wang's avatar Nancy Wang Committed by Commit Bot

Add the restore preference for the full restore feature.

This CL adds the "settings.restore_apps_and_pages" preference item to
prepare for the full restore feature.
DD: go/chrome-os-full-restore-dd

BUG=1146900

Change-Id: I259cc7fac01e77407337dbc2942ef645191c6057
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533213
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826594}
parent 2886e15a
......@@ -1411,6 +1411,8 @@ source_set("chromeos") {
"first_run/steps/app_list_step.h",
"first_run/steps/tray_step.cc",
"first_run/steps/tray_step.h",
"full_restore/full_restore_prefs.cc",
"full_restore/full_restore_prefs.h",
"guest_os/guest_os_external_protocol_handler.cc",
"guest_os/guest_os_external_protocol_handler.h",
"guest_os/guest_os_pref_names.cc",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/full_restore/full_restore_prefs.h"
#include "ash/public/cpp/ash_features.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
namespace chromeos {
namespace full_restore {
// An integer pref to define whether restore apps and web pages on startup.
// Refer to |RestoreOption|.
const char kRestoreAppsAndPagesPrefName[] = "settings.restore_apps_and_pages";
// TODO(https://crbug.com/1131969): Add the restore user preference init, and
// modificaiton implementation.
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
if (ash::features::IsFullRestoreEnabled()) {
registry->RegisterIntegerPref(
kRestoreAppsAndPagesPrefName, static_cast<int>(RestoreOption::kAlways),
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PREF);
}
}
} // namespace full_restore
} // namespace chromeos
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_FULL_RESTORE_FULL_RESTORE_PREFS_H_
#define CHROME_BROWSER_CHROMEOS_FULL_RESTORE_FULL_RESTORE_PREFS_H_
class PrefRegistrySimple;
namespace chromeos {
namespace full_restore {
// Enum that specifies restore options on startup. The values must not be
// changed as they are persisted on disk.
enum class RestoreOption {
kAlways = 1,
kAskEveryTime = 2,
kDoNotRestore = 3,
};
extern const char kRestoreAppsAndPagesPrefName[];
void RegisterProfilePrefs(PrefRegistrySimple* registry);
} // namespace full_restore
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FULL_RESTORE_FULL_RESTORE_PREFS_H_
......@@ -53,6 +53,7 @@
#include "ash/public/cpp/ambient/ambient_prefs.h"
#include "ash/public/cpp/ash_pref_names.h" // nogncheck
#include "chrome/browser/chromeos/crostini/crostini_pref_names.h"
#include "chrome/browser/chromeos/full_restore/full_restore_prefs.h"
#include "chrome/browser/chromeos/guest_os/guest_os_pref_names.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
......@@ -593,6 +594,10 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() {
(*s_allowlist)[arc::prefs::kAlwaysOnVpnLockdown] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
// Restore apps and pages on startup
(*s_allowlist)[chromeos::full_restore::kRestoreAppsAndPagesPrefName] =
settings_api::PrefType::PREF_TYPE_NUMBER;
// Timezone settings.
(*s_allowlist)[chromeos::kSystemTimezone] =
settings_api::PrefType::PREF_TYPE_STRING;
......
......@@ -276,6 +276,7 @@
#include "chrome/browser/chromeos/child_accounts/secondary_account_consent_logger.h"
#include "chrome/browser/chromeos/file_system_provider/registry.h"
#include "chrome/browser/chromeos/first_run/first_run.h"
#include "chrome/browser/chromeos/full_restore/full_restore_prefs.h"
#include "chrome/browser/chromeos/guest_os/guest_os_pref_names.h"
#include "chrome/browser/chromeos/lock_screen_apps/state_controller.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_mode_detector.h"
......@@ -944,6 +945,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
chromeos::FamilyUserSessionMetrics::RegisterProfilePrefs(registry);
chromeos::first_run::RegisterProfilePrefs(registry);
chromeos::file_system_provider::RegisterProfilePrefs(registry);
chromeos::full_restore::RegisterProfilePrefs(registry);
chromeos::KerberosCredentialsManager::RegisterProfilePrefs(registry);
chromeos::login::SecurityTokenSessionController::RegisterPrefs(registry);
chromeos::multidevice_setup::MultiDeviceSetupService::RegisterProfilePrefs(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment