capture-mode-demo-tools: Add nudge to grab user's attention
This CL adds a new nudge to grab user's attention of the new demo tools feature. Demo of the nudge is available at: http://b/263188273#comment2 Fixed: b:263188273 Test: Manually Change-Id: Ibcf617376b4f56b5286cd21b704273e46dc85ce6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4129782 Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Commit-Queue: Michele Fan <michelefan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1088249}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f245845363
commit
29a8ceac48
@ -4914,6 +4914,9 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SHOW_CAMERA_USER_NUDGE" desc="The message shown in a toast widget to nudge the user and alert them to check out the new settings that allow them to show camera during video recording.">
|
||||
You can now record yourself and your screen at the same time
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SHOW_DEMO_TOOLS_USER_NUDGE" desc="The message shown in a toast widget to nudge the user and alert them to check out the new settings that allow them to show clicks and keyboard shortcuts during video recording.">
|
||||
You can now show clicks and keyboard shortcuts in screen recordings
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SURFACE_TOO_SMALL_USER_NUDGE" desc="The message shown in a toast widget to alert the user that the current capture surface is too small to show the camera preview.">
|
||||
Region is too small to fit camera
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
38cde07894ba48197960e945cb73fa29f7e7ad78
|
@ -105,6 +105,13 @@ constexpr char kUsesDefaultCapturePathPrefName[] =
|
||||
// in such a way that the nudge no longer needs to be displayed again.
|
||||
constexpr char kCanShowCameraNudge[] = "ash.capture_mode.can_show_camera_nudge";
|
||||
|
||||
// The name of a boolean pref that determines whether we can show the demo tools
|
||||
// user nudge. When this pref is false, it means that we showed the nudge at
|
||||
// some point and the user interacted with the capture mode session UI in such a
|
||||
// way that the nudge no longer needs to be displayed again.
|
||||
constexpr char kCanShowDemoToolsNudge[] =
|
||||
"ash.capture_mode.can_show_demo_tools_nudge";
|
||||
|
||||
// The screenshot notification button index.
|
||||
enum ScreenshotNotificationButtonIndex {
|
||||
BUTTON_EDIT = 0,
|
||||
@ -453,7 +460,10 @@ void CaptureModeController::RegisterProfilePrefs(PrefRegistrySimple* registry) {
|
||||
/*default_value=*/base::FilePath());
|
||||
registry->RegisterBooleanPref(kUsesDefaultCapturePathPrefName,
|
||||
/*default_value=*/false);
|
||||
registry->RegisterBooleanPref(kCanShowCameraNudge, /*default_value=*/true);
|
||||
registry->RegisterBooleanPref(features::AreCaptureModeDemoToolsEnabled()
|
||||
? kCanShowDemoToolsNudge
|
||||
: kCanShowCameraNudge,
|
||||
/*default_value=*/true);
|
||||
}
|
||||
|
||||
bool CaptureModeController::IsActive() const {
|
||||
@ -561,11 +571,16 @@ bool CaptureModeController::CanShowUserNudge() const {
|
||||
|
||||
auto* pref_service = session_controller->GetActivePrefService();
|
||||
DCHECK(pref_service);
|
||||
return pref_service->GetBoolean(kCanShowCameraNudge);
|
||||
return pref_service->GetBoolean(features::AreCaptureModeDemoToolsEnabled()
|
||||
? kCanShowDemoToolsNudge
|
||||
: kCanShowCameraNudge);
|
||||
}
|
||||
|
||||
void CaptureModeController::DisableUserNudgeForever() {
|
||||
GetActiveUserPrefService()->SetBoolean(kCanShowCameraNudge, false);
|
||||
GetActiveUserPrefService()->SetBoolean(
|
||||
features::AreCaptureModeDemoToolsEnabled() ? kCanShowDemoToolsNudge
|
||||
: kCanShowCameraNudge,
|
||||
false);
|
||||
}
|
||||
|
||||
void CaptureModeController::SetUsesDefaultCaptureFolder(bool value) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "ash/capture_mode/capture_mode_session.h"
|
||||
#include "ash/capture_mode/capture_mode_util.h"
|
||||
#include "ash/constants/ash_features.h"
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
#include "ash/public/cpp/style/color_provider.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
@ -41,10 +42,14 @@ constexpr base::TimeDelta kDelayToDismissToast = base::Seconds(6);
|
||||
|
||||
std::u16string GetCaptureToastLabelOnToastType(
|
||||
CaptureToastType capture_toast_type) {
|
||||
const int nudge_message_id =
|
||||
features::AreCaptureModeDemoToolsEnabled()
|
||||
? IDS_ASH_SCREEN_CAPTURE_SHOW_DEMO_TOOLS_USER_NUDGE
|
||||
: IDS_ASH_SCREEN_CAPTURE_SHOW_CAMERA_USER_NUDGE;
|
||||
const int message_id =
|
||||
capture_toast_type == CaptureToastType::kCameraPreview
|
||||
? IDS_ASH_SCREEN_CAPTURE_SURFACE_TOO_SMALL_USER_NUDGE
|
||||
: IDS_ASH_SCREEN_CAPTURE_SHOW_CAMERA_USER_NUDGE;
|
||||
: nudge_message_id;
|
||||
return l10n_util::GetStringUTF16(message_id);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user