tree: 43d1ba5df23cfadde05494bc700e061d06d86d80 [path history] [tgz]
  1. bookmark_command_source.cc
  2. bookmark_command_source.h
  3. BUILD.gn
  4. command_source.cc
  5. command_source.h
  6. commander.cc
  7. commander.h
  8. commander_backend.h
  9. commander_controller.cc
  10. commander_controller.h
  11. commander_controller_unittest.cc
  12. commander_frontend.h
  13. commander_view_model.cc
  14. commander_view_model.h
  15. entity_match.cc
  16. entity_match.h
  17. entity_match_unittest.cc
  18. fuzzy_finder.cc
  19. fuzzy_finder.h
  20. fuzzy_finder.md
  21. fuzzy_finder_fuzzer.cc
  22. fuzzy_finder_unittest.cc
  23. open_url_command_source.cc
  24. open_url_command_source.h
  25. OWNERS
  26. README.md
  27. simple_command_source.cc
  28. simple_command_source.h
  29. tab_command_source.cc
  30. tab_command_source.h
  31. window_command_source.cc
  32. window_command_source.h
chrome/browser/ui/commander/README.md

Commander overview

This directory contains the bulk of the Commander, a new UI surface that allows users to access most Chromium functionality via a keyboard interface.

Components

The three main components of the commander are:

Frontend

The frontend is responsible for passing user input to the controller and displaying the subsequent results, delivered in a CommanderViewModel. The frontend conforms to the CommanderFrontend interface which currently has a single production implementation: CommanderFrontendViews. The actual interface is implemented in WebUI (see chrome/browser/ui/webui/commander).

Command Sources

Command sources (CommandSource) are responsible for providing a list of possible commands (CommandItem) for the user's current context, then executing them if they are chosen.

Backend

The backend is responsible for maintaining alist of command sources, passing user input to them, and sorting and ranking the result.

If a command requires more input (for example, choosing a window to move the current tab to), the command source will provide a callback which can receive user input and returns commands. The backend will then use this callback as the sole source to complete the multi-step command.

The backend conforms to the CommanderBackend interface and currently has a single production implementation: CommanderController.

Relationships

To sum up the relationships of the classes in this file: Commander (a singleton) owns a CommanderBackend and a CommanderFrontend. This class's ToggleForBrowser() method is the entirety of the Commander interface as far as the rest of the browser is concerned.

ToggleForBrowser() calls the method of the same name on the frontend. This hides the UI if it is showing on a different browser, then hides or shows it on the provided browser, depending on the current state. The frontend then sends user input to the backend, which responds with a view model of possible commands.

When the backend receives a message indicating that the user has chosen an option, the CommandItem is executed if it‘s “one-shot”. Otherwise, it’s a composite command; the backend passes a prompt text to the frontend, which updates the UI accordingly. The backend passes subsequent input to the provided callback until the command is either completed or cancelled. Composite commands can be nested to allow for multiple (for example: the user specifying two windows to merge together).

Fuzzy finder

Most CommandSources use FuzzyFinder to narrow down which commands to return. For more information, see the explainer.