Skip to content

Commit

Permalink
Merge ash/public/cpp/ash_switches.* into ash/constants/
Browse files Browse the repository at this point in the history
ash/{public/cpp,constants}/ash_switches.* serve the same purpose. The
latter is now the proper directory to add switches to.

Bug: 1164001
Change-Id: Ia306fb8813feb88e3fc8be1a0268fe8bfcdbb75b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944902
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Danil Chapovalov <danilchap@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#892593}
  • Loading branch information
hferreiro authored and Chromium LUCI CQ committed Jun 15, 2021
1 parent 1158daf commit 54c89f8
Show file tree
Hide file tree
Showing 97 changed files with 279 additions and 338 deletions.
2 changes: 1 addition & 1 deletion ash/accelerators/accelerator_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "ash/clipboard/clipboard_history_controller_impl.h"
#include "ash/components/audio/cras_audio_handler.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/constants/devicetype.h"
#include "ash/debug.h"
#include "ash/display/display_configuration_controller.h"
Expand All @@ -39,7 +40,6 @@
#include "ash/multi_profile_uma.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/assistant/controller/assistant_ui_controller.h"
#include "ash/public/cpp/new_window_delegate.h"
#include "ash/public/cpp/notification_utils.h"
Expand Down
2 changes: 1 addition & 1 deletion ash/accelerators/accelerator_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ash/app_list/test/app_list_test_helper.h"
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/capture_mode/capture_mode_types.h"
#include "ash/constants/ash_switches.h"
#include "ash/display/screen_orientation_controller.h"
#include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/ime/ime_controller_impl.h"
Expand All @@ -26,7 +27,6 @@
#include "ash/media/media_controller_impl.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/capture_mode_test_api.h"
#include "ash/public/cpp/ime_info.h"
#include "ash/public/cpp/shell_window_ids.h"
Expand Down
2 changes: 1 addition & 1 deletion ash/accelerators/debug_commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <utility>

#include "ash/accelerators/accelerator_commands.h"
#include "ash/constants/ash_switches.h"
#include "ash/hud_display/hud_display.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/debug_utils.h"
#include "ash/public/cpp/toast_data.h"
#include "ash/shell.h"
Expand Down
2 changes: 1 addition & 1 deletion ash/accelerators/magnifier_key_scroller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include "ash/accelerators/key_hold_detector.h"
#include "ash/accessibility/magnifier/full_screen_magnifier_controller.h"
#include "ash/constants/ash_switches.h"
#include "ash/keyboard/keyboard_util.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/shell.h"
#include "base/command_line.h"
#include "ui/events/event.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <vector>

#include "ash/accessibility/magnifier/magnifier_test_utils.h"
#include "ash/constants/ash_switches.h"
#include "ash/display/display_util.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/host/ash_window_tree_host.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/session/session_controller_impl.h"
#include "ash/session/test_session_controller_client.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ash/accessibility/magnifier/magnifier_utils.h"
#include "ash/keyboard/ui/keyboard_ui_controller.h"
#include "ash/keyboard/ui/keyboard_util.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/window_state.h"
Expand Down
2 changes: 1 addition & 1 deletion ash/app_list/app_list_presenter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "ash/app_list/views/search_result_list_view.h"
#include "ash/app_list/views/search_result_page_anchored_dialog.h"
#include "ash/app_list/views/search_result_page_view.h"
#include "ash/constants/ash_switches.h"
#include "ash/keyboard/keyboard_controller_impl.h"
#include "ash/keyboard/ui/keyboard_ui_controller.h"
#include "ash/keyboard/ui/test/keyboard_test_util.h"
Expand All @@ -39,7 +40,6 @@
#include "ash/public/cpp/app_list/app_list_switches.h"
#include "ash/public/cpp/app_list/app_list_types.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/keyboard/keyboard_switches.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/shelf_item_delegate.h"
Expand Down
1 change: 1 addition & 0 deletions ash/constants/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ component("constants") {
public_deps = [
"//base",
"//skia",
"//third_party/abseil-cpp:absl",
]
deps = [ "//build:branding_buildflags" ]
}
1 change: 1 addition & 0 deletions ash/constants/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include_rules = [
"+ash/constants",
"+base",
"+build",
"+third_party/abseil-cpp/absl/types/optional.h",
]

specific_include_rules = {
Expand Down
170 changes: 170 additions & 0 deletions ash/constants/ash_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/numerics/ranges.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"

namespace chromeos {
namespace switches {
Expand All @@ -26,6 +29,13 @@ const char kTestCrosGaiaIdMigration[] = "test-cros-gaia-id-migration";
// all stored user keys will be converted to GaiaId)
const char kTestCrosGaiaIdMigrationStarted[] = "started";

// Max and min number of seconds that must pass between showing user contextual
// nudges when override switch is set.
constexpr base::TimeDelta kAshContextualNudgesMinInterval =
base::TimeDelta::FromSeconds(0);
constexpr base::TimeDelta kAshContextualNudgesMaxInterval =
base::TimeDelta::FromSeconds(60);

} // namespace

// Please keep the order of these switches synchronized with the header file
Expand Down Expand Up @@ -160,6 +170,101 @@ const char kArcVmUreadaheadMode[] = "arcvm-ureadahead-mode";
// Madvises the kernel to use Huge Pages for guest memory.
const char kArcVmUseHugePages[] = "arcvm-use-hugepages";

// Clear the fast ink buffer upon creation. This is needed on some devices that
// do not zero out new buffers.
const char kAshClearFastInkBuffer[] = "ash-clear-fast-ink-buffer";

// Force the pointer (cursor) position to be kept inside root windows.
const char kAshConstrainPointerToRoot[] = "ash-constrain-pointer-to-root";

// Overrides the minimum time that must pass between showing user contextual
// nudges. Unit of time is in seconds.
const char kAshContextualNudgesInterval[] = "ash-contextual-nudges-interval";

// Reset contextual nudge shown count on login.
const char kAshContextualNudgesResetShownCount[] =
"ash-contextual-nudges-reset-shown-count";

// Enable keyboard shortcuts useful for debugging.
const char kAshDebugShortcuts[] = "ash-debug-shortcuts";

// Enable keyboard shortcuts used by developers only.
const char kAshDeveloperShortcuts[] = "ash-dev-shortcuts";

// Disable the Touch Exploration Mode. Touch Exploration Mode will no longer be
// turned on automatically when spoken feedback is enabled when this flag is
// set.
const char kAshDisableTouchExplorationMode[] =
"ash-disable-touch-exploration-mode";

// Enable cursor motion blur.
const char kAshEnableCursorMotionBlur[] = "ash-enable-cursor-motion-blur";

// Enables key bindings to scroll magnified screen.
const char kAshEnableMagnifierKeyScroller[] =
"ash-enable-magnifier-key-scroller";

// Enables the palette on every display, instead of only the internal one.
const char kAshEnablePaletteOnAllDisplays[] =
"ash-enable-palette-on-all-displays";

// If the flag is present, it indicates 1) the device has accelerometer and 2)
// the device is a convertible device or a tablet device (thus is capable of
// entering tablet mode). If this flag is not set, then the device is not
// capable of entering tablet mode. For example, Samus has accelerometer, but
// is not a covertible or tablet, thus doesn't have this flag set, thus can't
// enter tablet mode.
const char kAshEnableTabletMode[] = "enable-touchview";

// Enable the wayland server.
const char kAshEnableWaylandServer[] = "enable-wayland-server";

// Enables the stylus tools next to the status area.
const char kAshForceEnableStylusTools[] = "force-enable-stylus-tools";

// Forces the status area to allow collapse/expand regardless of the current
// state.
const char kAshForceStatusAreaCollapsible[] = "force-status-area-collapsible";

// Hides notifications that are irrelevant to Chrome OS device factory testing,
// such as battery level updates.
const char kAshHideNotificationsForFactory[] =
"ash-hide-notifications-for-factory";

// Power button position includes the power button's physical display side and
// the percentage for power button center position to the display's
// width/height in landscape_primary screen orientation. The value is a JSON
// object containing a "position" property with the value "left", "right",
// "top", or "bottom". For "left" and "right", a "y" property specifies the
// button's center position as a fraction of the display's height (in [0.0,
// 1.0]) relative to the top of the display. For "top" and "bottom", an "x"
// property gives the position as a fraction of the display's width relative to
// the left side of the display.
const char kAshPowerButtonPosition[] = "ash-power-button-position";

// The physical position info of the side volume button while in landscape
// primary screen orientation. The value is a JSON object containing a "region"
// property with the value "keyboard", "screen" and a "side" property with the
// value "left", "right", "top", "bottom".
const char kAshSideVolumeButtonPosition[] = "ash-side-volume-button-position";

// Enables the heads-up display for tracking touch points.
const char kAshTouchHud[] = "ash-touch-hud";

// Enables required things for the selected UI mode, regardless of whether the
// Chromebook is currently in the selected UI mode.
const char kAshUiMode[] = "force-tablet-mode";

// Values for the kAshUiMode flag.
const char kAshUiModeClamshell[] = "clamshell";
const char kAshUiModeTablet[] = "touch_view";

// (Most) Chrome OS hardware reports ACPI power button releases correctly.
// Standard hardware reports releases immediately after presses. If set, we
// lock the screen or shutdown the system immediately in response to a press
// instead of displaying an interactive animation.
const char kAuraLegacyPowerButton[] = "aura-legacy-power-button";

// If this flag is set, it indicates that this device is a "Cellular First"
// device. Cellular First devices use cellular telephone data networks as
// their primary means of connecting to the internet.
Expand Down Expand Up @@ -289,6 +394,9 @@ const char kEnableCastReceiver[] = "enable-cast-receiver";
// Enables consumer kiosk mode for Chrome OS.
const char kEnableConsumerKiosk[] = "enable-consumer-kiosk";

// Enables Shelf Dimming for ChromeOS.
const char kEnableDimShelf[] = "enable-dim-shelf";

// Enables sharing assets for installed default apps.
const char kEnableExtensionAssetsSharing[] = "enable-extension-assets-sharing";

Expand Down Expand Up @@ -424,11 +532,18 @@ const char kForceLoginManagerInTests[] = "force-login-manager-in-tests";
// Force system compositor mode when set.
const char kForceSystemCompositorMode[] = "force-system-compositor-mode";

// If set, tablet-like power button behavior (i.e. tapping the button turns the
// screen off) is used even if the device is in laptop mode.
const char kForceTabletPowerButton[] = "force-tablet-power-button";

// Specifies the device's form factor. If provided, this flag overrides the
// value from the LSB release info. Possible values are: "CHROMEBASE",
// "CHROMEBIT", "CHROMEBOOK", "REFERENCE", "CHROMEBOX"
const char kFormFactor[] = "form-factor";

// Sets the throttle fps for compositor frame submission.
const char kFrameThrottleFps[] = "frame-throttle-fps";

// Indicates that the browser is in "browse without sign-in" (Guest session)
// mode. Should completely disable extensions, sync and bookmarks.
const char kGuestSession[] = "bwsi";
Expand All @@ -448,6 +563,9 @@ const char kGuestWallpaperSmall[] = "guest-wallpaper-small";
// that only use external keyboards.
const char kHasChromeOSKeyboard[] = "has-chromeos-keyboard";

// Whether this device has an internal stylus.
const char kHasInternalStylus[] = "has-internal-stylus";

// Defines user homedir. This defaults to primary user homedir.
const char kHomedir[] = "homedir";

Expand Down Expand Up @@ -606,10 +724,22 @@ const char kShowLoginDevOverlay[] = "show-login-dev-overlay";
// testing. Limited to ChromeOS-on-linux and test images only.
const char kShowOobeDevOverlay[] = "show-oobe-dev-overlay";

// Draws a circle at each touch point, similar to the Android OS developer
// option "Show taps".
const char kShowTaps[] = "show-taps";

// Disables online sign-in enforcement in tast tests.
const char kSkipForceOnlineSignInForTesting[] =
"skip-force-online-signin-for-testing";

// If set, the device will be forced to stay in clamshell UI mode but screen
// auto rotation will be supported. E.g, chromebase device Dooly.
const char kSupportsClamshellAutoRotation[] =
"supports-clamshell-auto-rotation";

// Hides all Message Center notification popups (toasts). Used for testing.
const char kSuppressMessageCenterPopups[] = "suppress-message-center-popups";

// Specifies directory for the Telemetry System Web Extension.
const char kTelemetryExtensionDirectory[] = "telemetry-extension-dir";

Expand All @@ -635,6 +765,14 @@ const char kTetherStub[] = "tether-stub";
const char kTimeBeforeOnboardingSurveyInSecondsForTesting[] =
"time-before-onboarding-survey-in-seconds-for-testing";

// Chromebases' touchscreens can be used to wake from suspend, unlike the
// touchscreens on other Chrome OS devices. If set, the touchscreen is kept
// enabled while the screen is off so that it can be used to turn the screen
// back on after it has been turned off for inactivity but before the system has
// suspended.
const char kTouchscreenUsableWhileScreenOff[] =
"touchscreen-usable-while-screen-off";

// Shows all Bluetooth devices in UI (System Tray/Settings Page.)
const char kUnfilteredBluetoothDevices[] = "unfiltered-bluetooth-devices";

Expand Down Expand Up @@ -749,5 +887,37 @@ bool IsOsInstallAllowed() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kAllowOsInstall);
}

absl::optional<base::TimeDelta> ContextualNudgesInterval() {
int numeric_cooldown_time;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
kAshContextualNudgesInterval) &&
base::StringToInt(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
kAshContextualNudgesInterval),
&numeric_cooldown_time)) {
base::TimeDelta cooldown_time =
base::TimeDelta::FromSeconds(numeric_cooldown_time);
cooldown_time =
base::ClampToRange(cooldown_time, kAshContextualNudgesMinInterval,
kAshContextualNudgesMaxInterval);
return absl::optional<base::TimeDelta>(cooldown_time);
}
return absl::nullopt;
}

bool ContextualNudgesResetShownCount() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
kAshContextualNudgesResetShownCount);
}

bool IsUsingShelfAutoDim() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kEnableDimShelf);
}

bool ShouldClearFastInkBuffer() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
kAshClearFastInkBuffer);
}

} // namespace switches
} // namespace chromeos

0 comments on commit 54c89f8

Please sign in to comment.