1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
// Copyright 2020 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_CAPTURE_MODE_CAPTURE_MODE_CONSTANTS_H_
#define ASH_CAPTURE_MODE_CAPTURE_MODE_CONSTANTS_H_
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/highlight_border.h"
namespace ash::capture_mode {
constexpr gfx::Size kButtonSize{32, 32};
constexpr gfx::Insets kButtonPadding{0};
// The spacing used by the BoxLayout manager to space out child views in the
// CaptureModeBarView.
constexpr int kBetweenChildSpacing = 16;
// The amount the capture region changes when using the arrow keys to adjust it.
constexpr int kCtrlArrowKeyboardRegionChangeDp = 1;
constexpr int kArrowKeyboardRegionChangeDp = 15;
constexpr int kShiftArrowKeyboardRegionChangeDp = 40;
constexpr int kSpaceBetweenCaptureBarAndSettingsMenu = 8;
// Constants needed to paint the highlight around the area being captured.
constexpr int kCaptureRegionBorderStrokePx = 1;
// This color is set to WHITE on purpose in both dark and light mode.
constexpr SkColor kRegionBorderColor = SK_ColorWHITE;
// Color of the dimming shield layer. It is set to dim the region that is
// outside of the region will be recorded, either in the capture session or
// video recording is in progress.
constexpr ui::ColorId kDimmingShieldColor = cros_tokens::kCrosSysScrim;
// The space between the `image_toggle_button_` and `video_toggle_button_`.
constexpr int kSpaceBetweenCaptureModeTypeButtons = 2;
// The minimum value we use to clamp the camera preview diameter.
constexpr int kMinCameraPreviewDiameter = 120;
// The minimum value if the diameter of the expanded camera preview goes below
// which, the camera preview will be considered too small to be collapsible.
constexpr int kMinCollapsibleCameraPreviewDiameter = 150;
// The minimum value of the shorter side of the surface within which the camera
// preview is confined. Less values will cause the camera preview to hide.
constexpr int kMinCaptureSurfaceShortSideLengthForVisibleCamera = 176;
// The value by which we divide the shorter side of the surface within which the
// camera preview is confined (e.g. the display work area when recrding the
// fullscreen) to calculate the expanded diameter.
constexpr int kCaptureSurfaceShortSideDivider = 4;
// The divider used to calculate the collapsed diameter from the expanded
// diameter.
constexpr int kCollapsedPreviewDivider = 2;
// Size of the camera preview border.
constexpr int kCameraPreviewBorderSize = 4;
// The space between the camera preview and edges of the bounds that will be
// recorded.
constexpr int kSpaceBetweenCameraPreviewAndEdges = 16;
// The space between the bottom of camera preview resize button and the bottom
// of the camera preview.
constexpr int kSpaceBetweenResizeButtonAndCameraPreview = 12;
// The duration to continue showing resize button since the mouse exiting the
// preview bounds or the last tap on the preview widget.
constexpr base::TimeDelta kResizeButtonShowDuration = base::Milliseconds(4500);
// When capture UI (capture bar, capture label) is overlapped with user
// capture region or camera preview, and the mouse is not hovering over the
// capture UI, drop the opacity to this value to make the region or camera
// preview easier to see.
constexpr float kCaptureUiOverlapOpacity = 0.15f;
// Size of the icon in the capture mode settings menu.
constexpr gfx::Size kSettingsIconSize{20, 20};
// Border value used for each section of the settings menu.
constexpr auto kSettingsMenuBorderSize = gfx::Insets::VH(8, 16);
// The distance between the bottom of the key combo viewer and the bottom of the
// confined bounds.
constexpr int kKeyWidgetDistanceFromBottom = 24;
// Border value applied between the right edge of the key combo viewer when it's
// approaching the right edge of the recording area.
constexpr int kKeyWidgetBorderPadding = 16;
// The duration to continue showing the key combo view on key up of the
// non-modifier key with no modifier keys pressed or on key up of the last
// modifier key up with no non-modifier key that can be displayed independently
// pressed.
constexpr base::TimeDelta kRefreshKeyComboWidgetLongDelay =
base::Milliseconds(1500);
// The duration to hold on the update of the key combo view on key up.
constexpr base::TimeDelta kRefreshKeyComboWidgetShortDelay =
base::Milliseconds(100);
// The radius of the highlight layer generated on mouse or touch event when the
// demo tools feature is enabled.
constexpr int kHighlightLayerRadius = 36;
// The thickness of the highlight border that will be applied to the
// `PointerHighlightLayer`.
constexpr float kInnerHightlightBorderThickness =
0.5 * views::kHighlightBorderThickness;
constexpr float kOuterHightlightBorderThickness =
1.5 * views::kHighlightBorderThickness;
// Distance from the bottom of the capture bar to the bottom of the anchor
// bounds of the bar. See `GetBarAnchorBoundsInScreen` for more details of the
// bar's anchor bounds.
constexpr int kCaptureBarBottomPadding = 16;
constexpr int kGameCaptureBarBottomPadding = 24;
// Height of the capture bar.
constexpr int kCaptureBarHeight = 64;
// The minimum distance from the top of the screen to the top of the settings
// menu.
constexpr int kMinDistanceFromSettingsToScreen = 8;
// The minimum height of the settings menu while constrained and scrollable.
constexpr int kSettingsMenuMinHeight = 50;
// Animation parameters for capture UI (capture bar, capture label) overlapping
// the user capture region or camera preview. The default animation duration for
// opacity changes to the capture UI.
inline constexpr base::TimeDelta kCaptureUIOpacityChangeDuration =
base::Milliseconds(100);
// Search result panel dimensions.
inline constexpr int kPanelPaddingSize = 16;
inline constexpr int kSearchResultsPanelWebViewWidth = 360;
inline constexpr int kSearchResultsPanelTotalHeight = 492;
inline constexpr int kSearchResultsPanelTotalWidth =
capture_mode::kSearchResultsPanelWebViewWidth +
2 * capture_mode::kPanelPaddingSize;
inline constexpr int kSearchResultsPanelWebViewHeight =
kSearchResultsPanelTotalHeight - 2 * kPanelPaddingSize -
/*button_size=*/24 - /*padding_size=*/12;
// The distance between the search result panel and the work area.
constexpr int kPanelWorkAreaSpacing = 10;
// The distance between the search result panel and the feedback button (if
// available).
constexpr int kPanelButtonSpacing = 10;
// The ID for the nudge anchored to the Sunfish button in the launcher.
inline constexpr char kSunfishLauncherNudgeId[] = "kSunfishLauncherNudge";
// The nudge will not be shown if it already been shown 3 times, or if 24
// hours have not yet passed since it was last shown.
constexpr int kSunfishNudgeMaxShownCount = 3;
inline constexpr base::TimeDelta kSunfishNudgeTimeBetweenShown =
base::Hours(24);
// The minimum and maximum region glow blur amount.
inline constexpr float kRegionGlowAnimationMinBlurDp = 16.0f;
inline constexpr float kRegionGlowAnimationMaxBlurDp = 32.0f;
// The minimum and maximum glow outset from the edge of the capture region.
inline constexpr int kRegionGlowMinOutsetDp = 0;
inline constexpr int kRegionGlowMaxOutsetDp = 6;
// The view ID for the search results panel loading animation.
inline constexpr int kLoadingAnimationViewId = 1;
} // namespace ash::capture_mode
#endif // ASH_CAPTURE_MODE_CAPTURE_MODE_CONSTANTS_H_
|