tree: e7b8e0a190c7d89e98458b5c51feeefb0e8256f2 [path history] [tgz]
  1. accelerators/
  2. accelerometer/
  3. accessibility/
  4. animation/
  5. app_list/
  6. app_menu/
  7. ash_strings_grd/
  8. assistant/
  9. autoclick/
  10. autotest/
  11. components/
  12. custom_tab/
  13. dbus/
  14. detachable_base/
  15. display/
  16. drag_drop/
  17. events/
  18. first_run/
  19. frame/
  20. high_contrast/
  21. highlighter/
  22. home_screen/
  23. host/
  24. ime/
  25. keyboard/
  26. kiosk_next/
  27. laser/
  28. lock_screen_action/
  29. login/
  30. magnifier/
  31. media/
  32. metrics/
  33. multi_device_setup/
  34. multi_user/
  35. perftests/
  36. policy/
  37. public/
  38. resources/
  39. rotator/
  40. session/
  41. shelf/
  42. shell/
  43. sticky_keys/
  44. strings/
  45. system/
  46. test/
  47. tooltips/
  48. touch/
  49. tray_action/
  50. utility/
  51. voice_interaction/
  52. wallpaper/
  53. wayland/
  54. wm/
  55. ash_export.h
  56. ash_prefs.cc
  57. ash_service.cc
  58. ash_service.h
  59. ash_strings.grd
  60. bluetooth_devices_observer.cc
  61. bluetooth_devices_observer.h
  62. BUILD.gn
  63. cancel_mode.cc
  64. cancel_mode.h
  65. debug.cc
  66. debug.h
  67. DEPS
  68. dip_unittest.cc
  69. disconnected_app_handler.cc
  70. disconnected_app_handler.h
  71. extended_desktop_unittest.cc
  72. focus_cycler.cc
  73. focus_cycler.h
  74. focus_cycler_unittest.cc
  75. login_status.h
  76. main.cc
  77. mojo_interface_factory.cc
  78. mojo_interface_factory.h
  79. mojo_test_interface_factory.cc
  80. mojo_test_interface_factory.h
  81. multi_profile_uma.cc
  82. multi_profile_uma.h
  83. network_connect_delegate_mus.cc
  84. network_connect_delegate_mus.h
  85. new_window_controller.cc
  86. new_window_controller.h
  87. note_taking_controller.cc
  88. note_taking_controller.h
  89. OWNERS
  90. README.md
  91. root_window_controller.cc
  92. root_window_controller.h
  93. root_window_controller_unittest.cc
  94. root_window_settings.cc
  95. root_window_settings.h
  96. scoped_animation_disabler.cc
  97. scoped_animation_disabler.h
  98. scoped_root_window_for_new_windows.cc
  99. scoped_root_window_for_new_windows.h
  100. screen_util.cc
  101. screen_util.h
  102. screen_util_unittest.cc
  103. screenshot_delegate.h
  104. shell.cc
  105. shell.h
  106. shell_delegate.h
  107. shell_delegate_mash.cc
  108. shell_delegate_mash.h
  109. shell_init_params.cc
  110. shell_init_params.h
  111. shell_observer.h
  112. shell_state.cc
  113. shell_state.h
  114. shell_state_unittest.cc
  115. shell_test_api.cc
  116. shell_unittest.cc
  117. shutdown_controller.cc
  118. shutdown_controller.h
  119. shutdown_reason.cc
  120. shutdown_reason.h
  121. test_media_client.cc
  122. test_media_client.h
  123. test_screenshot_delegate.cc
  124. test_screenshot_delegate.h
  125. test_shell_delegate.cc
  126. test_shell_delegate.h
  127. window_factory.cc
  128. window_factory.h
  129. window_tree_host_lookup.cc
  130. window_user_data.h
  131. window_user_data_unittest.cc
ash/README.md

Ash

Ash is the “Aura Shell”, the window manager and system UI for Chrome OS. Ash uses the views UI toolkit (e.g. views::View, views::Widget, etc.) backed by the aura native widget and layer implementations.

Ash sits below chrome in the dependency graph (i.e. it cannot depend on code in //chrome).

Tests

Tests should be added to the ash_unittests target.

Tests can bring up most of the ash UI and simulate a login session by deriving from AshTestBase. This is often needed to test code that depends on ash::Shell and the controllers it owns.

Test support code (TestFooDelegate, FooControllerTestApi, etc.) lives in the same directory as the class under test (e.g. //ash/foo rather than //ash/test). Test code uses namespace ash; there is no special “test” namespace.

Mash

Ash is transitioning to run as a mojo service in its own process. This change means that code in chrome cannot call into ash directly, but must use the mojo interfaces in //ash/public/interfaces.

Out-of-process Ash is referred to as “mash” (mojo ash). In-process ash is referred to as “classic ash”. Ash can run in either mode depending on the --enable-features=Mash command line flag.

In the few cases where chrome code is allowed to call into ash (e.g. code that will only ever run in classic ash) the #include lines have “// mash-ok” appended. This makes it easier to use grep to determine which parts of chrome have not yet been adapted to mash.

Ash used to support a “mus” mode that ran the mojo window service from //services/ui on a background thread in the browser process. This configuration was deprecated in April 2018.

SingleProcessMash

Before launching Mash we plan to launch SingleProcessMash. SingleProcessMash is similar to “classic ash” in that ash and the browser still live in the same process and on the same thread, but all non-ash UI code (such as browser windows) will use the WindowService over mojo. This results in exercising much of the same code as in mash, but everything is still in the process.

In SingleProcessMash mode there are two aura::Envs. Ash (Shell) creates one and the browser creates one. In order to ensure the right one is used do the following:

. When creating a Widget set the parent and/or context. If you don't need a specific parent (container), more often than not using a context of Shell::GetRootWindowForNewWindows() is what you want. . If you are creating aura::Windows directly, use the ash::window_factory. . If you need access to aura::Env, get it from Shell. Shell always returns the right one, regardless of mode.

See https://docs.google.com/document/d/11ha_KioDdXe4iZS2AML1foKnCJlNKm7Q1hFr6VW8dV4/edit for more details.

Mash Tests

ash_unittests has some tests specific to Mash, but in general Ash code should not need to do anything special for Mash. AshTestBase offers functions that simulate a remote client (such as the browser) creating a window.

To enable browser_tests to run in Mash use “--enable-features=Mash”. As Mash is still a work in progress not all tests pass. A filter file is used on the bots to exclude failing tests (testing/buildbot/filters/mash.browser_tests.filter).

To simulate what the bots run (e.g. to check if you broke an existing test that works under mash) you can run:

browser_tests --enable-features=Mash --test-launcher-filter-file=testing/buildbot/filters/mash.browser_tests.filter

Any new feature you add (and its tests) should work under mash. If your test cannot pass under mash due to some dependency being broken you may add the test to the filter file. Make sure there is a bug for the underlying issue and cite it in the filter file.

Prefs

Ash supports both per-user prefs and device-wide prefs. These are called “profile prefs” and “local state” to match the naming conventions in chrome. Ash also supports “signin screen” prefs, bound to a special profile that allows users to toggle features like spoken feedback at the login screen.

Local state prefs are loaded asynchronously during startup. User prefs are loaded asynchronously after login, and after adding a multiprofile user. Code that wants to observe prefs must wait until they are loaded. See ShellObserver::OnLocalStatePrefServiceInitialized() and SessionObserver::OnActiveUserPrefServiceChanged(). All PrefService objects exist for the lifetime of the login session, including the signin prefs.

Pref names are in //ash/public/cpp so that code in chrome can also use the names. Prefs are registered in the classes that use them because those classes have the best knowledge of default values.

All PrefService instances in ash are backed by the mojo preferences service. This means an update to a pref is asynchronous between code in ash and code in chrome. For example, if code in chrome changes a pref value then immediately calls a C++ function in ash, that ash function may not see the new value yet. (This pattern only happens in the classic ash configuration; code in chrome cannot call directly into the ash process in the mash config.)

Prefs are either “owned” by ash or by chrome browser. New prefs used by ash should be owned by ash. See NightLightController and LogoutButtonTray for examples of ash-owned prefs. See //services/preferences/README.md for details of pref ownership and “foreign” prefs.

Historical notes

Ash shipped on Windows for a couple years to support Windows 8 Metro mode. Windows support was removed in 2016.