-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
float: Move nudge controller from ash/ to chromeos/
The first step for making the nudge work in lacros. This CL just moves the controller into chromeos, and removes all ash/ dependencies. Lacros support to be added in the future. Old (ash) -> New (chromeos) TabletModeController -> TabletState SessionController -> Delegate SystemToastStyle -> Custom Label TODO: Remove controller and have frame size button own the nudge. Make calls to controller handle async operations, for lacros. Test: existing, manual Bug: b/267787811 Change-Id: I8c5c325a6edfacf0f513679ce761b9356e010156 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4234910 Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Commit-Queue: Sammie Quon <sammiequon@chromium.org> Cr-Commit-Position: refs/heads/main@{#1104715}
- Loading branch information
Sammie Quon
authored and
Chromium LUCI CQ
committed
Feb 13, 2023
1 parent
a705013
commit 2bb7e39
Showing
20 changed files
with
290 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
ash/ash_strings_grd/IDS_TABLET_MULTITASK_MENU_NUDGE_TEXT.png.sha1
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/wm/multitask_menu_nudge_delegate_ash.h" | ||
|
||
#include "ash/session/session_controller_impl.h" | ||
#include "ash/shell.h" | ||
#include "components/prefs/pref_service.h" | ||
|
||
namespace ash { | ||
|
||
namespace { | ||
|
||
PrefService* GetPrefService() { | ||
return Shell::Get()->session_controller()->GetActivePrefService(); | ||
} | ||
|
||
std::string GetShowCountPrefName(bool tablet_mode) { | ||
return tablet_mode | ||
? chromeos::MultitaskMenuNudgeController::kTabletShownCountPrefName | ||
: chromeos::MultitaskMenuNudgeController:: | ||
kClamshellShownCountPrefName; | ||
} | ||
|
||
std::string GetLastShownPrefName(bool tablet_mode) { | ||
return tablet_mode | ||
? chromeos::MultitaskMenuNudgeController::kTabletLastShownPrefName | ||
: chromeos::MultitaskMenuNudgeController:: | ||
kClamshellLastShownPrefName; | ||
} | ||
|
||
} // namespace | ||
|
||
MultitaskMenuNudgeDelegateAsh::MultitaskMenuNudgeDelegateAsh() = default; | ||
|
||
MultitaskMenuNudgeDelegateAsh::~MultitaskMenuNudgeDelegateAsh() = default; | ||
|
||
bool MultitaskMenuNudgeDelegateAsh::IsRegularUser() const { | ||
auto* session_controller = Shell::Get()->session_controller(); | ||
const absl::optional<user_manager::UserType> user_type = | ||
session_controller->GetUserType(); | ||
return user_type == user_manager::USER_TYPE_REGULAR; | ||
} | ||
|
||
int MultitaskMenuNudgeDelegateAsh::GetShowCount(bool tablet_mode) const { | ||
return GetPrefService()->GetInteger(GetShowCountPrefName(tablet_mode)); | ||
} | ||
|
||
void MultitaskMenuNudgeDelegateAsh::SetShowCount(int count, bool tablet_mode) { | ||
GetPrefService()->SetInteger(GetShowCountPrefName(tablet_mode), count); | ||
} | ||
|
||
base::Time MultitaskMenuNudgeDelegateAsh::GetLastShownTime( | ||
bool tablet_mode) const { | ||
return GetPrefService()->GetTime(GetLastShownPrefName(tablet_mode)); | ||
} | ||
|
||
void MultitaskMenuNudgeDelegateAsh::SetLastShownTime(base::Time time, | ||
bool tablet_mode) { | ||
GetPrefService()->SetTime(GetLastShownPrefName(tablet_mode), time); | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_WM_MULTITASK_MENU_NUDGE_DELEGATE_ASH_ | ||
#define ASH_WM_MULTITASK_MENU_NUDGE_DELEGATE_ASH_ | ||
|
||
#include "chromeos/ui/frame/multitask_menu/multitask_menu_nudge_controller.h" | ||
|
||
namespace ash { | ||
|
||
// Ash implementation of nudge controller delegate that lets us get and set pref | ||
// values from the ash active profile. | ||
class MultitaskMenuNudgeDelegateAsh | ||
: public chromeos::MultitaskMenuNudgeController::Delegate { | ||
public: | ||
MultitaskMenuNudgeDelegateAsh(); | ||
MultitaskMenuNudgeDelegateAsh(const MultitaskMenuNudgeDelegateAsh&) = delete; | ||
MultitaskMenuNudgeDelegateAsh& operator=( | ||
const MultitaskMenuNudgeDelegateAsh&) = delete; | ||
~MultitaskMenuNudgeDelegateAsh() override; | ||
|
||
// chromeos::MultitaskMenuNudgeController::Delegate: | ||
bool IsRegularUser() const override; | ||
int GetShowCount(bool tablet_mode) const override; | ||
void SetShowCount(int count, bool tablet_mode) override; | ||
base::Time GetLastShownTime(bool tablet_mode) const override; | ||
void SetLastShownTime(base::Time time, bool tablet_mode) override; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_WM_MULTITASK_MENU_NUDGE_DELEGATE_ASH_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
chromeos/chromeos_strings_grd/IDS_MULTITASK_MENU_NUDGE_TEXT.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a5bdc20bd716abf26cfb91196d67c456dd053c03 |
1 change: 1 addition & 0 deletions
1
chromeos/chromeos_strings_grd/IDS_TABLET_MULTITASK_MENU_NUDGE_TEXT.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
99d2d3f1b4ad3485a0099968ab49372653482e10 |
Oops, something went wrong.