diff options
-rw-r--r-- | ash/ash_switches.cc | 9 | ||||
-rw-r--r-- | ash/ash_switches.h | 3 | ||||
-rw-r--r-- | ash/display/root_window_transformers.cc | 19 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 6 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 1 |
6 files changed, 40 insertions, 4 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 1240839..91ebb56 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -38,6 +38,10 @@ const char kAshDefaultWallpaperIsOem[] = "ash-default-wallpaper-is-oem"; const char kAshDefaultWallpaperLarge[] = "ash-default-wallpaper-large"; const char kAshDefaultWallpaperSmall[] = "ash-default-wallpaper-small"; +// Enables text filtering with the keyboard in Overview Mode. +const char kAshDisableTextFilteringInOverviewMode[] = + "ash-disable-text-filtering-in-overview-mode"; + // Disables LockLayoutManager used for LockScreenContainer, return back to // WorkspaceLayoutManager. const char kAshDisableLockLayoutManager[] = "ash-disable-lock-layout-manager"; @@ -54,9 +58,8 @@ const char kAshEnableMagnifierKeyScroller[] = "ash-enable-magnifier-key-scroller"; #endif -// Enables text filtering with the keyboard in Overview Mode. -const char kAshDisableTextFilteringInOverviewMode[] = - "ash-disable-text-filtering-in-overview-mode"; +// Enables mirrored screen. +const char kAshEnableMirroredScreen[] = "ash-enable-mirrored-screen"; // Enables quick, non-cancellable locking of the screen when in maximize mode. const char kAshEnablePowerButtonQuickLock[] = diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 5e4a18c..9e2c11d 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -25,11 +25,12 @@ ASH_EXPORT extern const char kAshDefaultWallpaperIsOem[]; ASH_EXPORT extern const char kAshDefaultWallpaperLarge[]; ASH_EXPORT extern const char kAshDefaultWallpaperSmall[]; ASH_EXPORT extern const char kAshDisableLockLayoutManager[]; +ASH_EXPORT extern const char kAshDisableTextFilteringInOverviewMode[]; ASH_EXPORT extern const char kAshDisableTouchExplorationMode[]; #if defined(OS_CHROMEOS) ASH_EXPORT extern const char kAshEnableMagnifierKeyScroller[]; #endif -ASH_EXPORT extern const char kAshDisableTextFilteringInOverviewMode[]; +ASH_EXPORT extern const char kAshEnableMirroredScreen[]; ASH_EXPORT extern const char kAshEnablePowerButtonQuickLock[]; ASH_EXPORT extern const char kAshEnableSoftwareMirroring[]; ASH_EXPORT extern const char kAshEnableSystemSounds[]; diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc index acaccaa..505cbba 100644 --- a/ash/display/root_window_transformers.cc +++ b/ash/display/root_window_transformers.cc @@ -6,12 +6,14 @@ #include <cmath> +#include "ash/ash_switches.h" #include "ash/display/display_info.h" #include "ash/display/display_manager.h" #include "ash/host/root_window_transformer.h" #include "ash/magnifier/magnification_controller.h" #include "ash/shell.h" #include "base/basictypes.h" +#include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "third_party/skia/include/utils/SkMatrix44.h" #include "ui/aura/window_event_dispatcher.h" @@ -122,6 +124,15 @@ gfx::Transform CreateInsetsAndScaleTransform(const gfx::Insets& insets, return transform; } +gfx::Transform CreateMirrorTransform(const gfx::Display& display) { + gfx::Transform transform; + transform.matrix().set3x3(-1, 0, 0, + 0, 1, 0, + 0, 0, 1); + transform.Translate(-display.size().width(), 0); + return transform; +} + // RootWindowTransformer for ash environment. class AshRootWindowTransformer : public RootWindowTransformer { public: @@ -137,7 +148,15 @@ class AshRootWindowTransformer : public RootWindowTransformer { display.device_scale_factor(), root_window_ui_scale_) * CreateRotationTransform(root, display); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshEnableMirroredScreen)) { + // Apply the tranform that flips the screen image horizontally so that + // the screen looks normal when reflected on a mirror. + root_window_bounds_transform_ = + root_window_bounds_transform_ * CreateMirrorTransform(display); + } transform_ = root_window_bounds_transform_ * CreateMagnifierTransform(root); + CHECK(transform_.GetInverse(&invert_transform_)); } diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e92612c..80056e4 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6062,6 +6062,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_ASH_ENABLE_TOUCH_VIEW_TESTING_DESCRIPTION" desc="Description for the flag to enable the TouchView testing mode."> Enable Ctrl+Alt+Shift+8 to toggle the TouchView maximizing mode. </message> + <message name="IDS_FLAGS_ASH_ENABLE_MIRRORED_SCREEN_NAME" desc="Title for the flag to enable the mirrored screen mode."> + Enable mirrored screen mode. + </message> + <message name="IDS_FLAGS_ASH_ENABLE_MIRRORED_SCREEN_DESCRIPTION" desc="Description for the flag to enable the mirrored screen mode."> + Enable the mirrored screen mode. This mode flips the screen image horizontally. + </message> <message name="IDS_FLAGS_ENABLE_TOUCH_FEEDBACK_NAME" desc="Title for the flag to enable additional visual feedback for touch."> Enable additional touch feedback on UI components. </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 2200e28..9ba3b24 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1053,6 +1053,12 @@ const Experiment kExperiments[] = { kOsCrOS, SINGLE_VALUE_TYPE(ash::switches::kAshDisableTextFilteringInOverviewMode), }, + { "ash-enable-mirrored-screen", + IDS_FLAGS_ASH_ENABLE_MIRRORED_SCREEN_NAME, + IDS_FLAGS_ASH_ENABLE_MIRRORED_SCREEN_DESCRIPTION, + kOsCrOS, + SINGLE_VALUE_TYPE(ash::switches::kAshEnableMirroredScreen), + }, #endif // defined(USE_ASH) #if defined(OS_CHROMEOS) { diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 4d493e3..c06b504 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -48380,6 +48380,7 @@ To add a new entry, add it with any value and run test to compute valid value. label="disable-minimize-on-second-launcher-item-click"/> <int value="1408331660" label="enhanced-bookmarks-experiment"/> <int value="1410697724" label="mediadrm-enable-non-compositing"/> + <int value="1416592483" label="ash-enable-mirrored-screen"/> <int value="1442798825" label="enable-quic"/> <int value="1459529277" label="disable-text-input-focus-manager"/> <int value="1465624446" label="disable-zero-copy"/> |