tree: e10f12c184dd4d79cb746ddd7838e6f9566e4485 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. PRESUBMIT.py
  5. README.md
  6. accelerators/
  7. accessibility/
  8. animation/
  9. app_launch_unittest.cc
  10. app_list/
  11. app_menu/
  12. ash_export.h
  13. ash_service.cc
  14. ash_service.h
  15. ash_service_unittest.cc
  16. ash_strings.grd
  17. ash_strings_grd/
  18. ash_unittests_manifest.json
  19. assistant/
  20. autoclick/
  21. bluetooth_devices_observer.cc
  22. bluetooth_devices_observer.h
  23. cancel_mode.cc
  24. cancel_mode.h
  25. cast_config_controller.cc
  26. cast_config_controller.h
  27. components/
  28. content/
  29. cursor_unittest.cc
  30. dbus/
  31. debug.cc
  32. debug.h
  33. detachable_base/
  34. dip_unittest.cc
  35. disconnected_app_handler.cc
  36. disconnected_app_handler.h
  37. display/
  38. drag_drop/
  39. events/
  40. extended_desktop_unittest.cc
  41. first_run/
  42. focus_cycler.cc
  43. focus_cycler.h
  44. focus_cycler_unittest.cc
  45. frame/
  46. high_contrast/
  47. highlighter/
  48. host/
  49. ime/
  50. keyboard/
  51. laser/
  52. lock_screen_action/
  53. login/
  54. login_status.h
  55. magnifier/
  56. main.cc
  57. manifest.json
  58. media/
  59. media_controller.cc
  60. media_controller.h
  61. metrics/
  62. mojo_interface_factory.cc
  63. mojo_interface_factory.h
  64. mojo_test_interface_factory.cc
  65. mojo_test_interface_factory.h
  66. multi_device_setup/
  67. multi_profile_uma.cc
  68. multi_profile_uma.h
  69. mus_property_mirror_ash_unittest.cc
  70. network_connect_delegate_mus.cc
  71. network_connect_delegate_mus.h
  72. new_window_controller.cc
  73. new_window_controller.h
  74. note_taking_controller.cc
  75. note_taking_controller.h
  76. perftests/
  77. policy/
  78. public/
  79. resources/
  80. root_window_controller.cc
  81. root_window_controller.h
  82. root_window_controller_unittest.cc
  83. root_window_settings.cc
  84. root_window_settings.h
  85. rotator/
  86. scoped_animation_disabler.cc
  87. scoped_animation_disabler.h
  88. scoped_root_window_for_new_windows.cc
  89. scoped_root_window_for_new_windows.h
  90. screen_util.cc
  91. screen_util.h
  92. screen_util_unittest.cc
  93. screenshot_delegate.h
  94. session/
  95. shelf/
  96. shell.cc
  97. shell.h
  98. shell/
  99. shell_delegate.h
  100. shell_delegate_mash.cc
  101. shell_delegate_mash.h
  102. shell_init_params.cc
  103. shell_init_params.h
  104. shell_observer.h
  105. shell_state.cc
  106. shell_state.h
  107. shell_state_unittest.cc
  108. shell_test_api.cc
  109. shell_test_api.h
  110. shell_unittest.cc
  111. shutdown_controller.cc
  112. shutdown_controller.h
  113. shutdown_reason.cc
  114. shutdown_reason.h
  115. sticky_keys/
  116. strings/
  117. system/
  118. test/
  119. test_media_client.cc
  120. test_media_client.h
  121. test_screenshot_delegate.cc
  122. test_screenshot_delegate.h
  123. test_shell_delegate.cc
  124. test_shell_delegate.h
  125. tooltips/
  126. touch/
  127. tray_action/
  128. utility/
  129. voice_interaction/
  130. wallpaper/
  131. wayland/
  132. window_factory.cc
  133. window_factory.h
  134. window_user_data.h
  135. window_user_data_unittest.cc
  136. wm/
  137. ws/
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). It has a few dependencies on //content, but these are isolated in their own module in //ash/content. This allows targets like ash_unittests to build more quickly.

Tests

Most tests should be added to the ash_unittests target. Tests that rely on //content should be added to ash_content_unittests, but these should be rare.

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.