post-login: Add update string for the dialog
We do this by storing the last seen software version and checking if the new one is greater. And some more renaming of pine. Test: manual Test: browser_tests InformedRestoreTest.Update Change-Id: Ib15801e2beb6b81106e60fbc0f4ad3786c2a83ac Fixed: b/328807089 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5703238 Commit-Queue: Sammie Quon <sammiequon@chromium.org> Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Cr-Commit-Position: refs/heads/main@{#1328401}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
052866afeb
commit
cc0fb5dcde
ash
ash_strings.grd
ash_strings_grd
constants
wm
lock_state_controller.cclock_state_controller_unittest.cc
overview
birch
overview_session.ccwindow_restore
chrome/browser/ash/app_restore
@ -8294,6 +8294,9 @@ To shut down the device, press and hold the power button on the device again.
|
||||
<message name="IDS_ASH_INFORMED_RESTORE_DIALOG_CRASH_DESCRIPTION" desc="Label of the description for the informed restore dialog, if the previous session ended with a crash. Gives a little more information than the title.">
|
||||
Your Chromebook restarted unexpectedly. Open your previous windows and apps.
|
||||
</message>
|
||||
<message name="IDS_ASH_INFORMED_RESTORE_DIALOG_UPDATE_DESCRIPTION" desc="Label of the description for the informed restore dialog, if the previous session was on a earlier version.">
|
||||
Your Chromebook has been updated. Open your previous windows and apps.
|
||||
</message>
|
||||
<message name="IDS_ASH_INFORMED_RESTORE_DIALOG_NO_THANKS_BUTTON" desc="Label of the no thanks button for the informed restore dialog, which users can click if they choose not to restore.">
|
||||
No thanks
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
39ae79f4aaa91cee6b699179686b5c38f84610fd
|
@ -284,14 +284,6 @@ inline constexpr char kMultitaskMenuNudgeClamshellLastShown[] =
|
||||
inline constexpr char kMultitaskMenuNudgeTabletLastShown[] =
|
||||
"cros.wm_nudge.tablet_multitask_nudge_last_shown";
|
||||
|
||||
// The number of times we have shown the informed restore education nudge.
|
||||
inline constexpr char kInformedRestoreNudgeShownCount[] =
|
||||
"ash.wm.informed_restore_nudge_shown_count";
|
||||
|
||||
// The last time we showed the informed restore education nudge.
|
||||
inline constexpr char kInformedRestoreNudgeLastShown[] =
|
||||
"ash.wm.informed_restore_nudge_last_shown";
|
||||
|
||||
// The following SAML-related prefs are not settings that the domain admin can
|
||||
// set, but information that the SAML Identity Provider can send us:
|
||||
|
||||
@ -1035,21 +1027,35 @@ inline constexpr char kLocalStateDevicePeripheralDataAccessEnabled[] =
|
||||
inline constexpr char kLoginShutdownTimestampPrefName[] =
|
||||
"ash.shelf.login_shutdown_timestamp";
|
||||
|
||||
// A `TimeDelta` pref indicates the length of time for taking the pine
|
||||
// screenshot on shutdown.
|
||||
inline constexpr char kPineScreenshotTakenDuration[] =
|
||||
// The number of times we have shown the informed restore education nudge.
|
||||
inline constexpr char kInformedRestoreNudgeShownCount[] =
|
||||
"ash.wm.informed_restore_nudge_shown_count";
|
||||
|
||||
// The last time we showed the informed restore education nudge.
|
||||
inline constexpr char kInformedRestoreNudgeLastShown[] =
|
||||
"ash.wm.informed_restore_nudge_last_shown";
|
||||
|
||||
// A `TimeDelta` pref indicates the length of time for taking the informed
|
||||
// restore screenshot on shutdown. Pine is the old name for informed restore.
|
||||
inline constexpr char kInformedRestoreScreenshotTakenDuration[] =
|
||||
"ash.pine.screenshot_taken_duration";
|
||||
|
||||
// A `TimeDelta` pref indicates the length of time for encoding and writing the
|
||||
// pine screenshot to the disk.
|
||||
inline constexpr char kPineScreenshotEncodeAndSaveDuration[] =
|
||||
// informed restore screenshot to the disk. Pine is the old name for informed
|
||||
// restore.
|
||||
inline constexpr char kInformedRestoreScreenshotEncodeAndSaveDuration[] =
|
||||
"ash.pine.sreenshot_encode_and_save_duration";
|
||||
|
||||
// A boolean pref indicating whether the informed restore onboarding dialog
|
||||
// should be shown.
|
||||
// should be shown. Pine is the old name for informed restore.
|
||||
inline constexpr char kShowInformedRestoreOnboarding[] =
|
||||
"ash.pine.should_show_informed_restore_onboarding";
|
||||
|
||||
// A string pref that stores the last software version. Used to notify users if
|
||||
// there has been an update.
|
||||
inline constexpr char kInformedRestoreLastVersion[] =
|
||||
"ash.wm.informed_restore_last_version";
|
||||
|
||||
// A boolean pref that specifies if the cellular setup notification can be
|
||||
// shown or not. This notification should be shown post-OOBE if the user has a
|
||||
// cellular-capable device but no available cellular networks. It should only be
|
||||
|
@ -297,10 +297,11 @@ LockStateController::~LockStateController() {
|
||||
void LockStateController::RegisterPrefs(PrefRegistrySimple* registry) {
|
||||
registry->RegisterTimePref(prefs::kLoginShutdownTimestampPrefName,
|
||||
base::Time());
|
||||
registry->RegisterTimeDeltaPref(prefs::kPineScreenshotTakenDuration,
|
||||
base::TimeDelta());
|
||||
registry->RegisterTimeDeltaPref(prefs::kPineScreenshotEncodeAndSaveDuration,
|
||||
base::TimeDelta());
|
||||
registry->RegisterTimeDeltaPref(
|
||||
prefs::kInformedRestoreScreenshotTakenDuration, base::TimeDelta());
|
||||
registry->RegisterTimeDeltaPref(
|
||||
prefs::kInformedRestoreScreenshotEncodeAndSaveDuration,
|
||||
base::TimeDelta());
|
||||
}
|
||||
|
||||
void LockStateController::AddObserver(LockStateObserver* observer) {
|
||||
@ -969,9 +970,9 @@ void LockStateController::StartSessionStateChange(
|
||||
|
||||
void LockStateController::OnTakeScreenshotFailTimeout(
|
||||
RequestedSessionState requested_session_state) {
|
||||
SaveInformedRestoreScreenshotDuration(local_state_,
|
||||
prefs::kPineScreenshotTakenDuration,
|
||||
kTakeScreenshotFailTimeout);
|
||||
SaveInformedRestoreScreenshotDuration(
|
||||
local_state_, prefs::kInformedRestoreScreenshotTakenDuration,
|
||||
kTakeScreenshotFailTimeout);
|
||||
RecordScreenshotOnShutdownStatus(
|
||||
ScreenshotOnShutdownStatus::kFailedOnTakingScreenshotTimeout);
|
||||
mirror_wallpaper_layer_.reset();
|
||||
@ -994,9 +995,9 @@ void LockStateController::OnInformedRestoreImageTaken(
|
||||
}
|
||||
|
||||
take_screenshot_fail_timer_.Stop();
|
||||
SaveInformedRestoreScreenshotDuration(local_state_,
|
||||
prefs::kPineScreenshotTakenDuration,
|
||||
base::TimeTicks::Now() - start_time);
|
||||
SaveInformedRestoreScreenshotDuration(
|
||||
local_state_, prefs::kInformedRestoreScreenshotTakenDuration,
|
||||
base::TimeTicks::Now() - start_time);
|
||||
|
||||
mirror_wallpaper_layer_.reset();
|
||||
|
||||
@ -1017,11 +1018,10 @@ void LockStateController::OnInformedRestoreImageSaved(
|
||||
base::TimeTicks start_time,
|
||||
const base::FilePath& file_path) {
|
||||
SaveInformedRestoreScreenshotDuration(
|
||||
local_state_, prefs::kPineScreenshotEncodeAndSaveDuration,
|
||||
// This duration includes the time waiting for the
|
||||
// `ThreadPool` to start running the task, also the
|
||||
// time that the UI thread waits to get the reply
|
||||
// from the `ThreadPool`.
|
||||
local_state_, prefs::kInformedRestoreScreenshotEncodeAndSaveDuration,
|
||||
// This duration includes the time waiting for the `ThreadPool` to start
|
||||
// running the task, also the time that the UI thread waits to get the
|
||||
// reply from the `ThreadPool`.
|
||||
base::TimeTicks::Now() - start_time);
|
||||
RecordScreenshotOnShutdownStatus(ScreenshotOnShutdownStatus::kSucceeded);
|
||||
if (shutdown_canceled_) {
|
||||
|
@ -1105,10 +1105,11 @@ TEST_F(LockStateControllerInformedRestoreTest, ShutdownWithWindows) {
|
||||
auto* local_state = Shell::Get()->local_state();
|
||||
// Informed restore screenshot related durations were recorded.
|
||||
const base::TimeDelta screenshot_taken_duration =
|
||||
local_state->GetTimeDelta(prefs::kPineScreenshotTakenDuration);
|
||||
local_state->GetTimeDelta(prefs::kInformedRestoreScreenshotTakenDuration);
|
||||
EXPECT_FALSE(screenshot_taken_duration.is_zero());
|
||||
const base::TimeDelta screenshot_encode_and_save_duration =
|
||||
local_state->GetTimeDelta(prefs::kPineScreenshotEncodeAndSaveDuration);
|
||||
local_state->GetTimeDelta(
|
||||
prefs::kInformedRestoreScreenshotEncodeAndSaveDuration);
|
||||
EXPECT_FALSE(screenshot_encode_and_save_duration.is_zero());
|
||||
}
|
||||
|
||||
|
@ -74,8 +74,8 @@ std::string GetPrefNameFromSuggestionType(BirchSuggestionType type) {
|
||||
|
||||
} // namespace
|
||||
|
||||
BirchBarController::BirchBarController(bool from_pine_service)
|
||||
: from_pine_service_(from_pine_service) {
|
||||
BirchBarController::BirchBarController(bool is_informed_restore)
|
||||
: is_informed_restore_(is_informed_restore) {
|
||||
// Init and register the show suggestions pref changed callback.
|
||||
show_suggestions_pref_registrar_.Init(GetPrefService());
|
||||
show_suggestions_pref_registrar_.Add(
|
||||
@ -252,7 +252,7 @@ void BirchBarController::MaybeFetchDataFromModel() {
|
||||
// Fetching data from model.
|
||||
data_fetch_in_progress_ = true;
|
||||
birch_model->RequestBirchDataFetch(
|
||||
/*is_post_login=*/from_pine_service_,
|
||||
/*is_post_login=*/is_informed_restore_,
|
||||
base::BindOnce(&BirchBarController::OnItemsFetchedFromModel,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
} else if (!birch_model_observer_.IsObserving()) {
|
||||
|
@ -119,8 +119,8 @@ class ASH_EXPORT BirchBarController : public BirchModel::Observer,
|
||||
// Indicates if the data fetching is in progress.
|
||||
bool data_fetch_in_progress_ = false;
|
||||
|
||||
// True if the overview session was triggered by the pine service.
|
||||
const bool from_pine_service_;
|
||||
// True if the overview session is an informed restore session.
|
||||
const bool is_informed_restore_;
|
||||
|
||||
// Show/hide suggestions pref change registrar.
|
||||
PrefChangeRegistrar show_suggestions_pref_registrar_;
|
||||
|
@ -299,8 +299,8 @@ void BirchBarView::SetupChips(const std::vector<raw_ptr<BirchItem>>& items) {
|
||||
case State::kLoadingByUser:
|
||||
reason = RelayoutReason::kSetupByUser;
|
||||
break;
|
||||
// When loading in pine or reloading, directly perform fading in animation
|
||||
// since the bar was filled by chip loaders.
|
||||
// When loading for informed restore or reloading, directly perform fading
|
||||
// in animation since the bar was filled by chip loaders.
|
||||
case State::kLoadingForInformedRestore:
|
||||
case State::kReloading:
|
||||
break;
|
||||
|
@ -13,16 +13,16 @@
|
||||
|
||||
namespace ash {
|
||||
|
||||
// When entering in pine session and customizing suggestion types to show, the
|
||||
// birch bar needs to fetch data from model. While waiting for the data, the
|
||||
// loader views will show on birch bar with corresponding fading in and out
|
||||
// animations.
|
||||
// When entering an informed restore session and customizing suggestion types to
|
||||
// show, the birch bar needs to fetch data from the model. While waiting for the
|
||||
// data, the loader views will show on the birch bar with corresponding fading
|
||||
// in and out animations.
|
||||
class BirchChipLoaderView : public BirchChipButtonBase {
|
||||
METADATA_HEADER(BirchChipLoaderView, BirchChipButtonBase)
|
||||
|
||||
public:
|
||||
enum class Type {
|
||||
kInit, // Used during loading in pine.
|
||||
kInit, // Used during loading for informed restore.
|
||||
kReload, // Used when suggestions are customized by user.
|
||||
kNone,
|
||||
};
|
||||
|
@ -219,7 +219,7 @@ void OverviewSession::Init(
|
||||
// Create this before the birch bar widget.
|
||||
if (features::IsForestFeatureEnabled()) {
|
||||
birch_bar_controller_ = std::make_unique<BirchBarController>(
|
||||
/*from_pine_service=*/enter_exit_overview_type_ ==
|
||||
/*is_informed_restore=*/enter_exit_overview_type_ ==
|
||||
OverviewEnterExitType::kInformedRestore);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,13 @@ struct ASH_EXPORT InformedRestoreContentsData {
|
||||
InformedRestoreContentsData& operator=(const InformedRestoreContentsData&) = delete;
|
||||
~InformedRestoreContentsData();
|
||||
|
||||
// The dialog will display a different description string based on the type.
|
||||
enum class DialogType {
|
||||
kNormal,
|
||||
kCrash,
|
||||
kUpdate,
|
||||
};
|
||||
|
||||
struct AppInfo {
|
||||
AppInfo(const std::string& id, const std::string& title, int window_id);
|
||||
AppInfo(const std::string& app_id,
|
||||
@ -75,6 +82,9 @@ struct ASH_EXPORT InformedRestoreContentsData {
|
||||
// different strings in this case.
|
||||
bool last_session_crashed = false;
|
||||
|
||||
// The dialog will have slightly different strings depending on its type.
|
||||
DialogType dialog_type = DialogType::kNormal;
|
||||
|
||||
// Callbacks for the restore and cancel buttons.
|
||||
base::OnceClosure restore_callback;
|
||||
base::OnceClosure cancel_callback;
|
||||
|
@ -315,10 +315,20 @@ void InformedRestoreContentsView::CreateChildViews() {
|
||||
Shell::Get()->informed_restore_controller()->contents_data();
|
||||
CHECK(contents_data);
|
||||
const int title_message_id = IDS_ASH_INFORMED_RESTORE_DIALOG_TITLE;
|
||||
const int description_message_id =
|
||||
contents_data->last_session_crashed
|
||||
? IDS_ASH_INFORMED_RESTORE_DIALOG_CRASH_DESCRIPTION
|
||||
: IDS_ASH_INFORMED_RESTORE_DIALOG_DESCRIPTION;
|
||||
int description_message_id;
|
||||
switch (contents_data->dialog_type) {
|
||||
case InformedRestoreContentsData::DialogType::kNormal:
|
||||
description_message_id = IDS_ASH_INFORMED_RESTORE_DIALOG_DESCRIPTION;
|
||||
break;
|
||||
case InformedRestoreContentsData::DialogType::kCrash:
|
||||
description_message_id =
|
||||
IDS_ASH_INFORMED_RESTORE_DIALOG_CRASH_DESCRIPTION;
|
||||
break;
|
||||
case InformedRestoreContentsData::DialogType::kUpdate:
|
||||
description_message_id =
|
||||
IDS_ASH_INFORMED_RESTORE_DIALOG_UPDATE_DESCRIPTION;
|
||||
break;
|
||||
}
|
||||
|
||||
auto* primary_container_view = AddChildView(
|
||||
// In landscape mode, this box layout view is the container for the left
|
||||
|
@ -174,7 +174,6 @@ void InformedRestoreController::MaybeShowInformedRestoreOnboarding(
|
||||
void InformedRestoreController::
|
||||
MaybeStartInformedRestoreSessionDevAccelerator() {
|
||||
auto data = std::make_unique<InformedRestoreContentsData>();
|
||||
data->last_session_crashed = false;
|
||||
std::pair<base::OnceClosure, base::OnceClosure> split =
|
||||
base::SplitOnceCallback(base::BindOnce(
|
||||
&InformedRestoreController::MaybeEndInformedRestoreSession,
|
||||
|
@ -39,9 +39,9 @@ void RecordScreenshotDurations(PrefService* local_state) {
|
||||
};
|
||||
|
||||
record_uma(local_state, "Ash.Pine.ScreenshotTakenDuration",
|
||||
prefs::kPineScreenshotTakenDuration);
|
||||
prefs::kInformedRestoreScreenshotTakenDuration);
|
||||
record_uma(local_state, "Ash.Pine.ScreenshotEncodeAndSaveDuration",
|
||||
prefs::kPineScreenshotEncodeAndSaveDuration);
|
||||
prefs::kInformedRestoreScreenshotEncodeAndSaveDuration);
|
||||
}
|
||||
|
||||
void RecordDialogScreenshotVisibility(bool visible) {
|
||||
|
@ -29,6 +29,8 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
|
||||
registry->RegisterIntegerPref(prefs::kInformedRestoreNudgeShownCount, 0);
|
||||
registry->RegisterTimePref(prefs::kInformedRestoreNudgeLastShown,
|
||||
base::Time());
|
||||
registry->RegisterStringPref(prefs::kInformedRestoreLastVersion,
|
||||
std::string());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "ash/webui/settings/public/constants/routes.mojom.h"
|
||||
#include "ash/webui/settings/public/constants/setting.mojom-shared.h"
|
||||
#include "ash/wm/desks/templates/saved_desk_controller.h"
|
||||
#include "ash/wm/window_restore/informed_restore_contents_data.h"
|
||||
#include "ash/wm/window_restore/informed_restore_controller.h"
|
||||
#include "ash/wm/window_restore/window_restore_util.h"
|
||||
#include "base/barrier_callback.h"
|
||||
@ -30,6 +29,7 @@
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/version_info/version_info.h"
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ash/app_restore/app_restore_arc_task_handler.h"
|
||||
#include "chrome/browser/ash/app_restore/full_restore_app_launch_handler.h"
|
||||
@ -337,13 +337,27 @@ void FullRestoreService::Init(bool& show_notification) {
|
||||
PrefService* prefs = profile_->GetPrefs();
|
||||
DCHECK(prefs);
|
||||
|
||||
// Determine whether we should show the update string. Crash takes priority
|
||||
// over update but we do the computations to store the pref for the next
|
||||
// session here first. The pref may not be registered in certain unit tests.
|
||||
bool is_update = false;
|
||||
if (features::IsForestFeatureEnabled() &&
|
||||
prefs->HasPrefPath(prefs::kInformedRestoreLastVersion)) {
|
||||
const base::Version old_version(
|
||||
prefs->GetString(prefs::kInformedRestoreLastVersion));
|
||||
const base::Version current_version = version_info::GetVersion();
|
||||
prefs->SetString(prefs::kInformedRestoreLastVersion,
|
||||
current_version.GetString());
|
||||
is_update = old_version.IsValid() && current_version > old_version;
|
||||
}
|
||||
|
||||
// If the system crashed before reboot, show the restore notification.
|
||||
if (ExitTypeService::GetLastSessionExitType(profile_) == ExitType::kCrashed) {
|
||||
if (!HasRestorePref(prefs))
|
||||
SetDefaultRestorePrefIfNecessary(prefs);
|
||||
|
||||
MaybeShowRestoreNotification(kRestoreForCrashNotificationId,
|
||||
show_notification);
|
||||
MaybeShowRestoreNotification(
|
||||
InformedRestoreContentsData::DialogType::kCrash, show_notification);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -390,20 +404,26 @@ void FullRestoreService::Init(bool& show_notification) {
|
||||
}
|
||||
|
||||
switch (restore_pref) {
|
||||
case RestoreOption::kAlways:
|
||||
case RestoreOption::kAlways: {
|
||||
Restore();
|
||||
break;
|
||||
case RestoreOption::kAskEveryTime:
|
||||
MaybeShowRestoreNotification(kRestoreNotificationId, show_notification);
|
||||
}
|
||||
case RestoreOption::kAskEveryTime: {
|
||||
const auto dialog_type =
|
||||
is_update ? InformedRestoreContentsData::DialogType::kUpdate
|
||||
: InformedRestoreContentsData::DialogType::kNormal;
|
||||
MaybeShowRestoreNotification(dialog_type, show_notification);
|
||||
MaybeInitiateAdminTemplateAutoLaunch();
|
||||
break;
|
||||
case RestoreOption::kDoNotRestore:
|
||||
}
|
||||
case RestoreOption::kDoNotRestore: {
|
||||
if (features::IsForestFeatureEnabled()) {
|
||||
MaybeShowInformedRestoreOnboarding(/*restore_on=*/false);
|
||||
}
|
||||
::full_restore::FullRestoreSaveHandler::GetInstance()->AllowSave();
|
||||
MaybeInitiateAdminTemplateAutoLaunch();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,11 +618,11 @@ bool FullRestoreService::CanBeInited() const {
|
||||
}
|
||||
|
||||
void FullRestoreService::InitInformedRestoreContentsData(
|
||||
bool last_session_crashed) {
|
||||
InformedRestoreContentsData::DialogType dialog_type) {
|
||||
CHECK(app_launch_handler_->HasRestoreData());
|
||||
|
||||
contents_data_ = std::make_unique<InformedRestoreContentsData>();
|
||||
contents_data_->last_session_crashed = last_session_crashed;
|
||||
contents_data_->dialog_type = dialog_type;
|
||||
|
||||
contents_data_->restore_callback = base::BindOnce(
|
||||
&FullRestoreService::OnDialogRestore, weak_ptr_factory_.GetWeakPtr());
|
||||
@ -651,8 +671,9 @@ void FullRestoreService::InitInformedRestoreContentsData(
|
||||
}
|
||||
}
|
||||
|
||||
void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
|
||||
bool& show_notification) {
|
||||
void FullRestoreService::MaybeShowRestoreNotification(
|
||||
InformedRestoreContentsData::DialogType dialog_type,
|
||||
bool& show_notification) {
|
||||
if (!app_launch_handler_) {
|
||||
return;
|
||||
}
|
||||
@ -676,7 +697,10 @@ void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
|
||||
return;
|
||||
}
|
||||
|
||||
const bool last_session_crashed = id == kRestoreForCrashNotificationId;
|
||||
const bool last_session_crashed =
|
||||
dialog_type == InformedRestoreContentsData::DialogType::kCrash;
|
||||
const std::string id = last_session_crashed ? kRestoreForCrashNotificationId
|
||||
: kRestoreNotificationId;
|
||||
if (!app_launch_handler_->HasRestoreData()) {
|
||||
CHECK(features::IsForestFeatureEnabled());
|
||||
MaybeShowInformedRestoreOnboarding(/*restore_on=*/true);
|
||||
@ -701,7 +725,7 @@ void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
|
||||
if (features::IsForestFeatureEnabled()) {
|
||||
CHECK(delegate_);
|
||||
|
||||
InitInformedRestoreContentsData(last_session_crashed);
|
||||
InitInformedRestoreContentsData(dialog_type);
|
||||
|
||||
if (crosapi::browser_util::IsLacrosEnabled()) {
|
||||
crosapi::CrosapiManager::Get()
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "ash/public/cpp/accelerators.h"
|
||||
#include "ash/public/cpp/session/session_observer.h"
|
||||
#include "ash/wm/window_restore/informed_restore_contents_data.h"
|
||||
#include "base/callback_list.h"
|
||||
#include "base/gtest_prod_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
@ -32,11 +33,7 @@ namespace message_center {
|
||||
class Notification;
|
||||
} // namespace message_center
|
||||
|
||||
namespace ash {
|
||||
|
||||
struct InformedRestoreContentsData;
|
||||
|
||||
namespace full_restore {
|
||||
namespace ash::full_restore {
|
||||
|
||||
class FullRestoreAppLaunchHandler;
|
||||
class FullRestoreDataHandler;
|
||||
@ -159,11 +156,13 @@ class FullRestoreService : public KeyedService,
|
||||
// apps. Otherwise, returns false.
|
||||
bool CanBeInited() const;
|
||||
|
||||
void InitInformedRestoreContentsData(bool last_session_crashed);
|
||||
void InitInformedRestoreContentsData(
|
||||
InformedRestoreContentsData::DialogType dialog_type);
|
||||
|
||||
// Show the restore notification on startup.
|
||||
void MaybeShowRestoreNotification(const std::string& id,
|
||||
bool& show_notification);
|
||||
// Shows the restore notification or the informed restore dialog on startup.
|
||||
void MaybeShowRestoreNotification(
|
||||
InformedRestoreContentsData::DialogType dialog_type,
|
||||
bool& show_notification);
|
||||
|
||||
void RecordRestoreAction(const std::string& notification_id,
|
||||
RestoreAction restore_action);
|
||||
@ -263,8 +262,6 @@ class ScopedRestoreForTesting {
|
||||
~ScopedRestoreForTesting();
|
||||
};
|
||||
|
||||
} // namespace full_restore
|
||||
|
||||
} // namespace ash
|
||||
} // namespace ash::full_restore
|
||||
|
||||
#endif // CHROME_BROWSER_ASH_APP_RESTORE_FULL_RESTORE_SERVICE_H_
|
||||
|
@ -1226,7 +1226,8 @@ TEST_F(ForestFullRestoreServiceTestHavingFullRestoreFile, Crash) {
|
||||
MaybeStartInformedRestoreOverviewSession(testing::_))
|
||||
.WillOnce([](std::unique_ptr<InformedRestoreContentsData> data) {
|
||||
ASSERT_TRUE(data);
|
||||
EXPECT_TRUE(data->last_session_crashed);
|
||||
EXPECT_EQ(InformedRestoreContentsData::DialogType::kCrash,
|
||||
data->dialog_type);
|
||||
});
|
||||
CreateFullRestoreServiceForTesting(std::move(mock_delegate));
|
||||
|
||||
|
@ -559,6 +559,31 @@ IN_PROC_BROWSER_TEST_F(InformedRestoreTest, AppInfo) {
|
||||
EXPECT_EQ("jhdjimmaggjajfjphpljagpgkidjilnj", apps_infos[3].app_id);
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(InformedRestoreTest, PRE_Update) {
|
||||
// Need at least one window for restore data.
|
||||
Profile* profile = ProfileManager::GetActiveUserProfile();
|
||||
CreateBrowser(profile);
|
||||
EXPECT_EQ(1u, BrowserList::GetInstance()->size());
|
||||
|
||||
// Prepare for the main test body by setting the version to one that will be
|
||||
// less.
|
||||
profile->GetPrefs()->SetString(prefs::kInformedRestoreLastVersion, "0.0.0.0");
|
||||
|
||||
// Immediate save to full restore file to bypass the 2.5 second throttle.
|
||||
AppLaunchInfoSaveWaiter::Wait();
|
||||
}
|
||||
|
||||
// Verify that the app info that is sent to ash shell is dialog type update.
|
||||
IN_PROC_BROWSER_TEST_F(InformedRestoreTest, Update) {
|
||||
EXPECT_TRUE(BrowserList::GetInstance()->empty());
|
||||
|
||||
const InformedRestoreContentsData* contents_data =
|
||||
Shell::Get()->informed_restore_controller()->contents_data();
|
||||
ASSERT_TRUE(contents_data);
|
||||
EXPECT_EQ(InformedRestoreContentsData::DialogType::kUpdate,
|
||||
contents_data->dialog_type);
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(InformedRestoreTest, PRE_ReenterOverviewPineSession) {
|
||||
EXPECT_TRUE(BrowserList::GetInstance()->empty());
|
||||
CreateBrowser(ProfileManager::GetActiveUserProfile());
|
||||
|
Reference in New Issue
Block a user