diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/chromeos | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chromeos')
60 files changed, 2445 insertions, 477 deletions
diff --git a/chromium/chromeos/BUILD.gn b/chromium/chromeos/BUILD.gn index 3e6fe60f933..6f0abfca7e2 100644 --- a/chromium/chromeos/BUILD.gn +++ b/chromium/chromeos/BUILD.gn @@ -92,6 +92,8 @@ component("chromeos") { if (is_printing_ppd_provider_v3) { sources += [ + "printing/ppd_metadata_parser.cc", + "printing/ppd_metadata_parser.h", "printing/ppd_provider_v3.cc", "printing/printer_config_cache.cc", "printing/printer_config_cache.h", @@ -214,7 +216,12 @@ test("chromeos_unittests") { ] if (is_printing_ppd_provider_v3) { - sources += [ "printing/printer_config_cache_unittest.cc" ] + sources += [ + "printing/fake_printer_config_cache.cc", + "printing/fake_printer_config_cache.h", + "printing/ppd_metadata_parser_unittest.cc", + "printing/printer_config_cache_unittest.cc", + ] } else { sources += [ "printing/ppd_provider_unittest.cc" ] } @@ -271,6 +278,9 @@ if (is_chromeos_device) { tast_test("chrome_all_tast_tests") { # To disable a specific test, add it the following list and cite a bug. tast_disabled_tests = [ + # crbug.com/1097630 + "security.OpenFDs", + # crbug.com/1051059 "security.SELinuxProcessesARC", @@ -287,6 +297,9 @@ if (is_chromeos_device) { # crbug.com/1073084 "crostini.CopyPaste.wayland_to_x11_artifact", + + # crbug.com/1098810 + "security.SELinuxFilesSystem", ] } diff --git a/chromium/chromeos/assistant/assistant.gni b/chromium/chromeos/assistant/assistant.gni index 6f9e0a78675..231b5b227a9 100644 --- a/chromium/chromeos/assistant/assistant.gni +++ b/chromium/chromeos/assistant/assistant.gni @@ -3,7 +3,11 @@ import("//build/config/chrome_build.gni") declare_args() { # Enable assistant implementation based on libassistant. enable_cros_libassistant = is_chromeos && is_chrome_branded - enable_on_device_assistant = false + enable_cros_on_device_assistant = false + + # Enable a fake microphone, which can replay audio files as microphone input. + # See chromeos/assistant/tools/send-audio.sh + enable_fake_assistant_microphone = false } declare_args() { diff --git a/chromium/chromeos/components/BUILD.gn b/chromium/chromeos/components/BUILD.gn index 914a7cceef1..165a2305560 100644 --- a/chromium/chromeos/components/BUILD.gn +++ b/chromium/chromeos/components/BUILD.gn @@ -16,25 +16,31 @@ test("chromeos_components_unittests") { "//base/test:test_support", "//chromeos:chromeos_buildflags", "//chromeos/components/account_manager:unit_tests", + "//chromeos/components/cdm_factory_daemon:unit_tests", "//chromeos/components/drivefs:unit_tests", "//chromeos/components/mojo_bootstrap:unit_tests", "//chromeos/components/multidevice:unit_tests", - "//chromeos/components/nearby:unit_tests", "//chromeos/components/power:unit_tests", "//chromeos/components/proximity_auth:unit_tests", "//chromeos/components/quick_answers:unit_tests", "//chromeos/components/security_token_pin:unit_tests", "//chromeos/components/smbfs:unit_tests", + "//chromeos/components/string_matching:unit_tests", "//chromeos/components/sync_wifi:unit_tests", "//chromeos/components/tether:unit_tests", "//chromeos/components/trial_group:unit_tests", "//mojo/core/embedder", ] + + if (!is_official_build) { + deps += [ "//chromeos/components/telemetry_extension_ui:unit_tests" ] + } } group("closure_compile") { testonly = true deps = [ + "//chromeos/components/camera_app_ui:closure_compile", "//chromeos/components/help_app_ui:closure_compile", "//chromeos/components/media_app_ui:closure_compile", "//chromeos/components/multidevice/debug_webui/resources:closure_compile", @@ -42,6 +48,9 @@ group("closure_compile") { ] if (!is_official_build) { - deps += [ "//chromeos/components/sample_system_web_app_ui:closure_compile" ] + deps += [ + "//chromeos/components/sample_system_web_app_ui:closure_compile", + "//chromeos/components/telemetry_extension_ui/resources:closure_compile", + ] } } diff --git a/chromium/chromeos/components/camera_app_ui/BUILD.gn b/chromium/chromeos/components/camera_app_ui/BUILD.gn new file mode 100644 index 00000000000..44365f15485 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/BUILD.gn @@ -0,0 +1,51 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") +import("//third_party/closure_compiler/compile_js.gni") + +assert(is_chromeos, "Camera App is Chrome OS only") + +static_library("camera_app_ui") { + sources = [ + "camera_app_helper_impl.cc", + "camera_app_helper_impl.h", + "camera_app_ui.cc", + "camera_app_ui.h", + "url_constants.cc", + "url_constants.h", + ] + + deps = [ + ":mojo_bindings", + ":mojo_bindings_js", + "//ash/public/cpp", + "//chromeos/components/web_applications", + "//chromeos/constants", + "//chromeos/resources:camera_app_resources", + "//chromeos/strings", + "//chromeos/system", + "//content/public/browser", + "//content/public/common", + "//media/capture:capture_lib", + "//mojo/public/cpp/bindings", + "//mojo/public/cpp/platform", + "//mojo/public/js:resources_grit", + "//ui/resources:webui_resources_grd_grit", + "//ui/webui", + ] +} + +group("closure_compile") { + testonly = true + deps = [ + "resources:closure_compile", + ] +} + +mojom("mojo_bindings") { + sources = [ "camera_app_helper.mojom" ] + + deps = [ "//components/arc/mojom:camera_intent" ] +} diff --git a/chromium/chromeos/components/camera_app_ui/camera_app_helper.mojom b/chromium/chromeos/components/camera_app_ui/camera_app_helper.mojom new file mode 100644 index 00000000000..73605b72f0f --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/camera_app_helper.mojom @@ -0,0 +1,64 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module chromeos_camera.mojom; + +import "components/arc/mojom/camera_intent.mojom"; + +// Interface for monitoring tablet mode state of device. The state is detected +// from Chrome browser process and is notified to Chrome Camera App in renderer +// process. +interface TabletModeMonitor { + // Updates with the latest changed tablet mode state. + Update(bool is_tablet_mode); +}; + +// Screen backlight state. +// Reference from ash/public/cpp/screen_backlight_type.h +enum ScreenState { + ON, + OFF, + OFF_AUTO, +}; + +// Interface for monitoring screen state of device. The state is detected from +// Chrome browser process and is notified to Chrome Camera App in renderer +// process. +interface ScreenStateMonitor { + // Updates with the latest changed screen state. + Update(ScreenState state); +}; + +// Interface for communication between Chrome Camera App (Remote) and Chrome +// (Receiver). +interface CameraAppHelper { + // Sends the captured result |data| for corresponding intent recognized by + // |intent_id| back to ARC. The handler should handle |data| and may notify + // the intent caller according to the intention of the |action|. |is_success| + // will be set to true if the ARC received the result and set to false for + // invalid input. + HandleCameraResult(uint32 intent_id, + arc.mojom.CameraIntentAction action, + array<uint8> data) => (bool is_success); + + // Checks if device is under tablet mode currently. + IsTabletMode() => (bool is_tablet_mode); + + // Triggers the begin of event tracing for given |event|. + StartPerfEventTrace(string event); + + // Triggers the end of event tracing for given |event|. + StopPerfEventTrace(string event); + + // Registers a TabletModeMonitor instance and returns the tablet mode + // initial state. Calling the Update() whenever the tablet mode state + // changes. + SetTabletMonitor(pending_remote<TabletModeMonitor> monitor) + => (bool is_tablet_mode); + + // Registers a ScreenStateMonitor instance and returns the initial screen + // state. Calling the Update() whenever the screen state changes. + SetScreenStateMonitor(pending_remote<ScreenStateMonitor> monitor) + => (ScreenState initial_state); +}; diff --git a/chromium/chromeos/components/camera_app_ui/resources/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/BUILD.gn new file mode 100644 index 00000000000..8dba78c89f1 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/BUILD.gn @@ -0,0 +1,248 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +chrome_camera_app_dir = "$root_out_dir/resources/chromeos/camera" + +group("closure_compile") { + deps = [ "src/js:closure_compile" ] +} + +group("chrome_camera_app") { + # According to crbug.com/855747, we should list all the files we want to copy + # rather than list only the folders to avoid potential building issue and ease + # the difficulty to diagnose. + deps = [ "src/strings:camera_strings" ] + + data_deps = [ + ":chrome_camera_app_base", + ":chrome_camera_app_css", + ":chrome_camera_app_images", + ":chrome_camera_app_js", + ":chrome_camera_app_js_browser_proxy", + ":chrome_camera_app_js_device", + ":chrome_camera_app_js_lib", + ":chrome_camera_app_js_models", + ":chrome_camera_app_js_mojo", + ":chrome_camera_app_js_views", + ":chrome_camera_app_js_views_camera", + ":chrome_camera_app_mojo_generated", + ":chrome_camera_app_sounds", + ":chrome_camera_app_views", + ] +} + +copy("chrome_camera_app_base") { + sources = [ "src/manifest.json" ] + + outputs = [ "$chrome_camera_app_dir/{{source_file_part}}" ] +} + +copy("chrome_camera_app_css") { + sources = [ "src/css/main.css" ] + + outputs = [ "$chrome_camera_app_dir/css/{{source_file_part}}" ] +} + +copy("chrome_camera_app_images") { + sources = [ + "src/images/camera_app_icons_128.png", + "src/images/camera_app_icons_48.png", + "src/images/camera_button_fps_30.svg", + "src/images/camera_button_fps_60.svg", + "src/images/camera_button_grid_off.svg", + "src/images/camera_button_grid_on.svg", + "src/images/camera_button_mic_off.svg", + "src/images/camera_button_mic_on.svg", + "src/images/camera_button_mirror_off.svg", + "src/images/camera_button_mirror_on.svg", + "src/images/camera_button_settings.svg", + "src/images/camera_button_switch_device.svg", + "src/images/camera_button_switch_photo.svg", + "src/images/camera_button_switch_video.svg", + "src/images/camera_button_timer_off.svg", + "src/images/camera_button_timer_on_10s.svg", + "src/images/camera_button_timer_on_3s.svg", + "src/images/camera_focus_aim.svg", + "src/images/camera_intent_play_video.svg", + "src/images/camera_intent_result_cancel.svg", + "src/images/camera_intent_result_confirm.svg", + "src/images/camera_mode_photo.svg", + "src/images/camera_mode_portrait.svg", + "src/images/camera_mode_square.svg", + "src/images/camera_mode_video.svg", + "src/images/camera_shutter_photo_start.svg", + "src/images/camera_shutter_photo_start_active.svg", + "src/images/camera_shutter_photo_start_hover.svg", + "src/images/camera_shutter_photo_stop.svg", + "src/images/camera_shutter_photo_stop_hover.svg", + "src/images/camera_shutter_video_pause.svg", + "src/images/settings_button_back.svg", + "src/images/settings_button_expand.svg", + "src/images/settings_feedback.svg", + "src/images/settings_grid_type.svg", + "src/images/settings_help.svg", + "src/images/settings_resolution.svg", + "src/images/settings_timer_duration.svg", + "src/images/spinner.svg", + ] + + outputs = [ "$chrome_camera_app_dir/images/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js") { + sources = [ + "src/js/async_job_queue.js", + "src/js/background.js", + "src/js/background_ops.js", + "src/js/chrome_util.js", + "src/js/error.js", + "src/js/gallerybutton.js", + "src/js/intent.js", + "src/js/main.js", + "src/js/metrics.js", + "src/js/nav.js", + "src/js/perf.js", + "src/js/sound.js", + "src/js/state.js", + "src/js/toast.js", + "src/js/tooltip.js", + "src/js/type.js", + "src/js/util.js", + "src/js/waitable_event.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_browser_proxy") { + sources = [ + # TODO(b/129956426): Remove dependency used only in closure compiler check. + "src/js/browser_proxy/browser_proxy.js", + "src/js/browser_proxy/browser_proxy_interface.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/browser_proxy/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_device") { + sources = [ + "src/js/device/camera3_device_info.js", + "src/js/device/constraints_preferrer.js", + "src/js/device/device_info_updater.js", + "src/js/device/error.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/device/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_lib") { + sources = [ + "src/js/lib/analytics.js", + "src/js/lib/comlink.js", + "src/js/lib/ffmpeg.js", + "src/js/lib/ffmpeg.wasm", + ] + + outputs = [ "$chrome_camera_app_dir/js/lib/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_models") { + sources = [ + "src/js/models/async_writer.js", + "src/js/models/filenamer.js", + "src/js/models/filesystem.js", + "src/js/models/mp4_video_processor.js", + "src/js/models/nop_video_processor.js", + "src/js/models/result_saver.js", + "src/js/models/video_saver.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/models/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_mojo") { + sources = [ + "src/js/mojo/chrome_helper.js", + "src/js/mojo/device_operator.js", + "src/js/mojo/image_capture.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/mojo/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_views") { + sources = [ + "src/js/views/camera.js", + "src/js/views/camera_intent.js", + "src/js/views/dialog.js", + "src/js/views/settings.js", + "src/js/views/view.js", + "src/js/views/warning.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/views/{{source_file_part}}" ] +} + +copy("chrome_camera_app_js_views_camera") { + sources = [ + "src/js/views/camera/layout.js", + "src/js/views/camera/modes.js", + "src/js/views/camera/options.js", + "src/js/views/camera/preview.js", + "src/js/views/camera/recordtime.js", + "src/js/views/camera/review_result.js", + "src/js/views/camera/timertick.js", + ] + + outputs = [ "$chrome_camera_app_dir/js/views/camera/{{source_file_part}}" ] +} + +copy("chrome_camera_app_sounds") { + sources = [ + "src/sounds/record_end.ogg", + "src/sounds/record_pause.ogg", + "src/sounds/record_start.ogg", + "src/sounds/shutter.ogg", + "src/sounds/tick_final.ogg", + "src/sounds/tick_inc.ogg", + "src/sounds/tick_start.ogg", + ] + + outputs = [ "$chrome_camera_app_dir/sounds/{{source_file_part}}" ] +} + +copy("chrome_camera_app_views") { + sources = [ + "src/views/background.html", + "src/views/main.html", + ] + + outputs = [ "$chrome_camera_app_dir/views/{{source_file_part}}" ] +} + +copy("chrome_camera_app_mojo_generated") { + sources = [ + "$root_gen_dir/chromeos/components/camera_app_ui/camera_app_helper.mojom-lite.js", + "$root_gen_dir/components/arc/mojom/camera_intent.mojom-lite.js", + "$root_gen_dir/media/capture/mojom/image_capture.mojom-lite.js", + "$root_gen_dir/media/capture/video/chromeos/mojom/camera_app.mojom-lite.js", + "$root_gen_dir/media/capture/video/chromeos/mojom/camera_common.mojom-lite.js", + "$root_gen_dir/media/capture/video/chromeos/mojom/camera_metadata.mojom-lite.js", + "$root_gen_dir/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom-lite.js", + "$root_gen_dir/mojo/public/js/mojo_bindings_lite.js", + "$root_gen_dir/mojo/public/mojom/base/time.mojom-lite.js", + "$root_gen_dir/third_party/blink/public/mojom/idle/idle_manager.mojom-lite.js", + "$root_gen_dir/ui/gfx/geometry/mojom/geometry.mojom-lite.js", + "$root_gen_dir/ui/gfx/range/mojom/range.mojom-lite.js", + ] + + deps = [ + "//chromeos/components/camera_app_ui:mojo_bindings_js", + "//media/capture/video/chromeos/mojom:cros_camera_js", + "//mojo/public/js:bindings_lite", + "//third_party/blink/public/mojom:mojom_platform_js", + ] + + outputs = [ "$chrome_camera_app_dir/js/mojo/{{source_file_part}}" ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn new file mode 100644 index 00000000000..19cb7f9d981 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn @@ -0,0 +1,158 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +group("closure_compile") { + deps = [ + ":compile_resources", + "browser_proxy:closure_compile", + "device:closure_compile", + "models:closure_compile", + "mojo:closure_compile", + "views:closure_compile", + ] +} + +js_type_check("compile_resources") { + deps = [ + ":async_job_queue", + ":background", + ":background_ops", + ":chrome_util", + ":error", + ":gallerybutton", + ":intent", + ":main", + ":metrics", + ":nav", + ":perf", + ":sound", + ":state", + ":toast", + ":tooltip", + ":type", + ":util", + ":waitable_event", + ] +} + +js_library("async_job_queue") { +} + +js_library("chrome_util") { +} + +js_library("error") { + deps = [ ":metrics" ] +} + +js_library("intent") { + deps = [ + ":chrome_util", + ":metrics", + ":type", + "mojo:chrome_helper", + ] +} + +js_library("gallerybutton") { + deps = [ + ":chrome_util", + "models:filesystem", + "models:result_saver", + "models:video_saver", + ] + externs_list = [ + "$externs_path/file_manager_private.js", + "$externs_path/file_system_provider.js", + ] +} + +js_library("metrics") { + deps = [ + ":state", + "externs:universal_analytics_api", + ] +} + +js_library("sound") { +} + +js_library("type") { +} + +js_library("main") { + deps = [ + ":background_ops", + ":chrome_util", + ":gallerybutton", + ":intent", + ":state", + ":type", + "device:constraints_preferrer", + "device:device_info_updater", + "views:camera", + "views:camera_intent", + "views:dialog", + "views:settings", + "views:warning", + ] +} + +js_library("nav") { + deps = [ + "mojo:device_operator", + "views:view", + ] +} + +js_library("perf") { +} + +js_library("state") { + deps = [ + ":perf", + ":type", + ] +} + +js_library("background") { + deps = [ + ":background_ops", + ":intent", + ] +} + +js_library("background_ops") { + deps = [ + ":chrome_util", + ":error", + ":intent", + ":perf", + ] +} + +js_library("toast") { + deps = [ ":util" ] +} + +js_library("tooltip") { + deps = [ ":chrome_util" ] +} + +js_library("util") { + deps = [ + ":state", + ":tooltip", + ":type", + "browser_proxy:browser_proxy", + "externs:w3c_api", + "mojo:chrome_helper", + ] + externs_list = [ "$externs_path/chrome_extensions.js" ] +} + +js_library("waitable_event") { +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/BUILD.gn new file mode 100644 index 00000000000..909b9b4aea2 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ ":browser_proxy" ] +} + +js_library("browser_proxy") { + deps = [ + "..:chrome_util", + "../mojo:chrome_helper", + ] + sources = [ + "browser_proxy.js", + "browser_proxy_interface.js", + "webui_browser_proxy.js", + ] + externs_list = [ + "../externs/chrome.js", + "$externs_path/chrome_extensions.js", + "$externs_path/file_manager_private.js", + "$externs_path/file_system_provider.js", + "$externs_path/metrics_private.js", + ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/device/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/device/BUILD.gn new file mode 100644 index 00000000000..f4b59b69732 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/device/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ + ":camera3_device_info", + ":constraints_preferrer", + ":device_info_updater", + ":error", + ] +} + +js_library("camera3_device_info") { + deps = [ + "..:type", + "../mojo:image_capture", + ] +} + +js_library("constraints_preferrer") { + deps = [ + ":camera3_device_info", + "..:chrome_util", + "..:state", + "..:type", + "../browser_proxy:browser_proxy", + ] +} + +js_library("device_info_updater") { + deps = [ + ":camera3_device_info", + ":constraints_preferrer", + ":error", + "..:state", + "..:type", + ] +} + +js_library("error") { +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/externs/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/externs/BUILD.gn new file mode 100644 index 00000000000..cae1c53cb2d --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/externs/BUILD.gn @@ -0,0 +1,17 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_library("universal_analytics_api") { + sources = [] + + externs_list = [ "universal_analytics_api.js" ] +} + +js_library("w3c_api") { + sources = [] + + externs_list = [ "w3c_api.js" ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/lib/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/lib/BUILD.gn new file mode 100644 index 00000000000..67207741560 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/lib/BUILD.gn @@ -0,0 +1,13 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_library("comlink") { + sources = [ "comlink.js" ] +} + +js_library("ffmpeg") { + sources = [ "ffmpeg.js" ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/models/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/models/BUILD.gn new file mode 100644 index 00000000000..87d69aee82c --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/models/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ + ":filenamer", + ":filesystem", + ":result_saver", + ":video_saver", + ] +} + +js_library("filenamer") { +} + +js_library("filesystem") { + deps = [ + ":filenamer", + "../browser_proxy:browser_proxy", + ] +} + +js_library("result_saver") { +} + +js_library("video_saver") { + sources = [ + "async_writer.js", + "mp4_video_processor.js", + "nop_video_processor.js", + "video_saver.js", + ] + deps = [ + "..:async_job_queue", + "..:intent", + "..:waitable_event", + "../externs:w3c_api", + "../lib:comlink", + "../lib:ffmpeg", + ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn new file mode 100644 index 00000000000..39e91ba7cb5 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ + ":chrome_helper", + ":device_operator", + ":image_capture", + ] +} + +js_library("chrome_helper") { + deps = [ + "//chromeos/components/camera_app_ui:mojo_bindings_js_library_for_compile", + "//components/arc/mojom:camera_intent_js_library_for_compile", + "//third_party/blink/public/mojom:mojom_platform_js_library_for_compile", + ] + externs_list = [ "$externs_path/pending.js" ] +} + +js_library("device_operator") { + deps = [ + "..:type", + "//media/capture/video/chromeos/mojom:cros_camera_js_library_for_compile", + ] + externs_list = [ "$externs_path/pending.js" ] +} + +js_library("image_capture") { + deps = [ + ":device_operator", + "..:util", + "//media/capture/mojom:image_capture_js_library_for_compile", + ] + externs_list = [ "$externs_path/pending.js" ] +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/views/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/views/BUILD.gn new file mode 100644 index 00000000000..6cfbb72e337 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/views/BUILD.gn @@ -0,0 +1,67 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +group("closure_compile") { + deps = [ + ":compile_resources", + "camera:compile_resources", + ] +} + +js_type_check("compile_resources") { + deps = [ + ":camera", + ":camera_intent", + ":dialog", + ":settings", + ":view", + ":warning", + ] +} + +js_library("camera") { + deps = [ + "..:background_ops", + "..:chrome_util", + "..:metrics", + "..:type", + "../models:result_saver", + "camera:layout", + "camera:modes", + "camera:options", + "camera:preview", + "camera:timertick", + ] +} + +js_library("dialog") { +} + +js_library("camera_intent") { + deps = [ + ":camera", + "..:chrome_util", + "../models:video_saver", + "camera:review_result", + ] +} + +js_library("settings") { + deps = [ + ":view", + "..:nav", + "..:type", + "../device:camera3_device_info", + "../device:device_info_updater", + ] +} + +js_library("view") { + deps = [ "..:toast" ] +} + +js_library("warning") { +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn new file mode 100644 index 00000000000..e1b3817be17 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn @@ -0,0 +1,77 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +group("closure_compile") { + deps = [ ":compile_resources" ] +} + +js_type_check("compile_resources") { + deps = [ + ":layout", + ":modes", + ":options", + ":preview", + ":recordtime", + ":review_result", + ":timertick", + "../../mojo:device_operator", + ] +} + +js_library("layout") { + deps = [ + "../..:chrome_util", + "../..:type", + ] +} + +js_library("modes") { + deps = [ + ":recordtime", + "../../:async_job_queue", + "../..:sound", + "../..:toast", + "../..:type", + "../..:util", + "../../device:constraints_preferrer", + "../../models:filenamer", + "../../models:filesystem", + "../../models:video_saver", + "../../mojo:image_capture", + "//media/capture/video/chromeos/mojom:cros_camera_js_library_for_compile", + ] +} + +js_library("options") { + deps = [ + "../..:nav", + "../..:type", + "../..:util", + "../../device:device_info_updater", + ] +} + +js_library("preview") { + deps = [ + "../..:chrome_util", + "../..:nav", + "../..:type", + "//media/capture/video/chromeos/mojom:cros_camera_js_library_for_compile", + ] +} + +js_library("recordtime") { +} + +js_library("review_result") { + deps = [ + "../..:state", + "../..:util", + ] +} + +js_library("timertick") { +} diff --git a/chromium/chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn b/chromium/chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn new file mode 100644 index 00000000000..6535e9e8673 --- /dev/null +++ b/chromium/chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn @@ -0,0 +1,71 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//chrome/common/features.gni") +import("//tools/grit/grit_rule.gni") + +chrome_camera_app_dir = "$root_out_dir/resources/chromeos/camera" + +grit("camera_strings") { + source = "camera_strings.grd" + defines = chrome_grit_defines + outputs = [ + "_locales/am/messages.json", + "_locales/ar/messages.json", + "_locales/bg/messages.json", + "_locales/bn/messages.json", + "_locales/ca/messages.json", + "_locales/cs/messages.json", + "_locales/da/messages.json", + "_locales/de/messages.json", + "_locales/el/messages.json", + "_locales/en_GB/messages.json", + "_locales/en/messages.json", + "_locales/es/messages.json", + "_locales/es_419/messages.json", + "_locales/et/messages.json", + "_locales/fa/messages.json", + "_locales/fi/messages.json", + "_locales/fil/messages.json", + "_locales/fr/messages.json", + "_locales/gu/messages.json", + "_locales/he/messages.json", + "_locales/hi/messages.json", + "_locales/hr/messages.json", + "_locales/hu/messages.json", + "_locales/id/messages.json", + "_locales/it/messages.json", + "_locales/ja/messages.json", + "_locales/kn/messages.json", + "_locales/ko/messages.json", + "_locales/lt/messages.json", + "_locales/lv/messages.json", + "_locales/ml/messages.json", + "_locales/mr/messages.json", + "_locales/ms/messages.json", + "_locales/nl/messages.json", + "_locales/nb/messages.json", + "_locales/pl/messages.json", + "_locales/pt_BR/messages.json", + "_locales/pt_PT/messages.json", + "_locales/ro/messages.json", + "_locales/ru/messages.json", + "_locales/sk/messages.json", + "_locales/sl/messages.json", + "_locales/sr/messages.json", + "_locales/sv/messages.json", + "_locales/sw/messages.json", + "_locales/ta/messages.json", + "_locales/te/messages.json", + "_locales/th/messages.json", + "_locales/tr/messages.json", + "_locales/uk/messages.json", + "_locales/vi/messages.json", + "_locales/zh_CN/messages.json", + "_locales/zh_TW/messages.json", + ] + output_dir = chrome_camera_app_dir + + resource_ids = "" +} diff --git a/chromium/chromeos/components/cdm_factory_daemon/BUILD.gn b/chromium/chromeos/components/cdm_factory_daemon/BUILD.gn new file mode 100644 index 00000000000..1efa3d0c41a --- /dev/null +++ b/chromium/chromeos/components/cdm_factory_daemon/BUILD.gn @@ -0,0 +1,51 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("cdm_factory_daemon_browser") { + sources = [ + "cdm_factory_daemon_proxy.cc", + "cdm_factory_daemon_proxy.h", + ] + public_deps = [ "//chromeos/components/cdm_factory_daemon/mojom" ] + deps = [ + "//base", + "//chromeos/dbus/cdm_factory_daemon", + "//content/public/browser", + "//mojo/public/cpp/bindings", + ] + defines = [ "IS_CDM_FACTORY_DAEMON_IMPL" ] +} + +component("cdm_factory_daemon_gpu") { + sources = [ + "cdm_storage_adapter.cc", + "cdm_storage_adapter.h", + ] + public_deps = [ + "//chromeos/components/cdm_factory_daemon/mojom", + "//media/mojo/mojom", + ] + deps = [ + "//base", + "//mojo/public/cpp/bindings", + ] + defines = [ "IS_CDM_FACTORY_DAEMON_IMPL" ] +} + +source_set("unit_tests") { + testonly = true + sources = [ "cdm_storage_adapter_unittest.cc" ] + + deps = [ + ":cdm_factory_daemon_gpu", + "//base", + "//base/test:test_support", + "//chromeos/components/cdm_factory_daemon/mojom", + "//mojo/public/cpp/bindings", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/chromium/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn b/chromium/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn new file mode 100644 index 00000000000..931b8311882 --- /dev/null +++ b/chromium/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom_component("mojom") { + sources = [ + "cdm_factory_daemon.mojom", + "cdm_storage.mojom", + ] + + public_deps = [ + "//components/arc/mojom:media", + "//components/arc/mojom:oemcrypto", + "//mojo/public/mojom/base", + ] + + output_prefix = "chromeos_cdm_mojom" + macro_prefix = "CHROMEOS_CDM_MOJOM" +} diff --git a/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom b/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom new file mode 100644 index 00000000000..456db38ff10 --- /dev/null +++ b/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom @@ -0,0 +1,39 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This defines the mojo interface used between Chrome and the Chrome OS for +// remoting of the Widevine CE CDM and the underlying OEMCrypto implementation. +// This CdmFactoryDaemon interface is bootstrapped over D-Bus and then methods +// can be invoked on it to create a factory and then CDM instance, that same +// interface can also be used to connect directly to the OEMCrypto +// implementation for ARC. + +module chromeos.cdm.mojom; + +import "components/arc/mojom/oemcrypto.mojom"; +import "components/arc/mojom/protected_buffer_manager.mojom"; + +// Next Method ID: 1 +interface CdmFactory { + // TODO(jkardatzke): Implement this interface. +}; + +// Next Method ID: 2 +// Used for bootstrapping the connection between Chrome and the daemon, then +// methods can be invoked to obtain interfaces to perform CDM or OEMCrypto +// operations. +interface CdmFactoryDaemon { + // Used to create CdmFactory interfaces which are then used to create a CDM + // interface. |key_system| should specify what key system we are using, + // currently only com.widevine.alpha is supported. Returns null if we can't + // get the interface from the daemon. + CreateFactory@0(string key_system) => (pending_remote<CdmFactory>? factory); + + // Used to establish a connection to the OEMCrypto implementation to provide + // that service to ARC. + ConnectOemCrypto@1( + arc.mojom.OemCryptoService& oemcryptor, + pending_remote<arc.mojom.ProtectedBufferManager> + protected_buffer_manager); +}; diff --git a/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_storage.mojom b/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_storage.mojom new file mode 100644 index 00000000000..624f761056b --- /dev/null +++ b/chromium/chromeos/components/cdm_factory_daemon/mojom/cdm_storage.mojom @@ -0,0 +1,43 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Next MinVersion: 2 + +module chromeos.cdm.mojom; + +// Provides a interface for per-origin/cdm storage handled by Chrome. This is +// meant to translate to the media/mojo/mojom/cdm_storage.mojom interface that +// is in Chrome but is tied more closely to the Widevine CE CDM IStorage +// interface on this end. This one exists for the purpose of being able to do +// version management so we can handle version diffs between Chrome and +// Chrome OS. +// Next Method ID: 5 +interface CdmStorage { + // Reads the contents of |file_name| and return them in |data|. Returns + // true and the file contents if successful. Errors reading the file or + // non-existent files will return false and an empty data array. + [Sync] + Read@0(string file_name) => (bool success, array<uint8> data); + + // Creates/overwrites the contents of |file_name| with |data|. If the + // write operation is successful, then true is returned, otherwise false is + // returned. The contents of the file are unknown if Write() fails. + [Sync] + Write@1(string file_name, array<uint8> data) => (bool success); + + // Determines whether the specified file name exists or not. Returns true + // if the file exists and false if it does not or an error occurred. + [Sync] + Exists@2(string file_name) => (bool success); + + // Gets the file size of the specified file name. Returned size is valid if + // status is true. + [Sync] + GetSize@3(string file_name) => (bool success, uint64 size); + + // Removes the file at the specified path. Returns true if the file does not + // exist or it exists and was removed; returns false otherwise. + [Sync] + Remove@4(string file_name) => (bool success); +}; diff --git a/chromium/chromeos/components/drivefs/mojom/drivefs.mojom b/chromium/chromeos/components/drivefs/mojom/drivefs.mojom index bdb45842aa6..bf7fc678de5 100644 --- a/chromium/chromeos/components/drivefs/mojom/drivefs.mojom +++ b/chromium/chromeos/components/drivefs/mojom/drivefs.mojom @@ -67,6 +67,34 @@ interface DriveFs { // encoded proto message. SendNativeMessageRequest(string request) => ( FileError error, string response); + + // Sets the arguments to be parsed by DriveFS on startup. Should only be + // called in developer mode. + SetStartupArguments(string arguments) => (bool success); + + // Gets the currently set arguments parsed by DriveFS on startup. Should only + // be called in developer mode. + GetStartupArguments() => (string arguments); + + // Enables or disables performance tracing, which logs to + // |data_dir_path|/Logs/drive_fs_trace. + SetTracingEnabled(bool enabled); + + // Enables or disables networking for testing. Should only be called in + // developer mode. + SetNetworkingEnabled(bool enabled); + + // Overrides syncing to be paused if enabled. Should only be called in + // developer mode. + ForcePauseSyncing(bool enable); + + // Dumps account settings (including feature flags) to + // |data_dir_path/account_settings. Should only be called in developer mode. + DumpAccountSettings(); + + // Loads account settings (including feature flags) from + // |data_dir_path/account_settings. Should only be called in developer mode. + LoadAccountSettings(); }; // Implemented by Chrome, used from DriveFS. @@ -111,7 +139,7 @@ interface DriveFsDelegate { OnHeartbeat(); }; -// Next MinVersion: 5 +// Next MinVersion: 6 struct DriveFsConfiguration { string user_email; @@ -128,6 +156,9 @@ struct DriveFsConfiguration { [MinVersion=4] bool enable_experimental_mirroring = false; + + [MinVersion=5] + bool enable_verbose_logging = false; }; enum AccessTokenStatus { diff --git a/chromium/chromeos/components/media_app_ui/resources/js/BUILD.gn b/chromium/chromeos/components/media_app_ui/resources/js/BUILD.gn index 2d9eff502cb..643bc13ac0b 100644 --- a/chromium/chromeos/components/media_app_ui/resources/js/BUILD.gn +++ b/chromium/chromeos/components/media_app_ui/resources/js/BUILD.gn @@ -4,9 +4,18 @@ import("//third_party/closure_compiler/compile_js.gni") +# Lint checks are not well documented, but pick up some useful stuff. Currently +# require it to be requested in developer builds only. +enable_lint_checks = false + # Note we compile with reportUnknownTypes while it works, but if dependencies # get more complex, we should remove it and only enable in developer builds. media_closure_flags = default_closure_args + [ + "conformance_configs " + rebase_path( + "../../../web_applications/closure_conformance_checks.txt", + root_build_dir), + "jscomp_error=conformanceViolations", + "jscomp_error=strictCheckTypes", "jscomp_error=reportUnknownTypes", "language_in=ECMASCRIPT_2018", @@ -17,6 +26,13 @@ media_closure_flags = default_closure_args + [ "hide_warnings_for=chromeos/components/media_app_ui/media_app_ui.mojom-lite-for-compile.js", ] +if (enable_lint_checks) { + media_closure_flags += [ + "jscomp_error=lintChecks", + "hide_warnings_for=mojo/public/interfaces/bindings", + ] +} + group("closure_compile") { deps = [ ":closure_compile_app", diff --git a/chromium/chromeos/components/nearby/BUILD.gn b/chromium/chromeos/components/nearby/BUILD.gn deleted file mode 100644 index 1530795ac8a..00000000000 --- a/chromium/chromeos/components/nearby/BUILD.gn +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") - -static_library("nearby") { - sources = [ - "atomic_boolean_impl.cc", - "atomic_boolean_impl.h", - "atomic_reference_impl.h", - "condition_variable_impl.cc", - "condition_variable_impl.h", - "count_down_latch_impl.cc", - "count_down_latch_impl.h", - "hash_utils_impl.cc", - "hash_utils_impl.h", - "lock_base.h", - "lock_impl.cc", - "lock_impl.h", - "multi_thread_executor_impl.cc", - "multi_thread_executor_impl.h", - "scheduled_executor_impl.cc", - "scheduled_executor_impl.h", - "settable_future_impl.h", - "single_thread_executor_impl.cc", - "single_thread_executor_impl.h", - "submittable_executor_base.cc", - "submittable_executor_base.h", - "system_clock_impl.cc", - "system_clock_impl.h", - "thread_utils_impl.cc", - "thread_utils_impl.h", - ] - - deps = [ - "//base", - "//chromeos/components/nearby/library", - "//crypto", - ] -} - -source_set("unit_tests") { - testonly = true - - sources = [ - "atomic_boolean_impl_unittest.cc", - "atomic_reference_impl_unittest.cc", - "condition_variable_impl_unittest.cc", - "count_down_latch_impl_unittest.cc", - "hash_utils_impl_unittest.cc", - "lock_impl_unittest.cc", - "scheduled_executor_impl_unittest.cc", - "settable_future_impl_unittest.cc", - "submittable_executor_base_unittest.cc", - ] - - deps = [ - ":nearby", - "//base", - "//base/test:test_support", - "//chromeos/components/nearby/library", - "//crypto", - "//testing/gtest", - ] -} diff --git a/chromium/chromeos/components/nearby/library/BUILD.gn b/chromium/chromeos/components/nearby/library/BUILD.gn deleted file mode 100644 index 3579bc5f032..00000000000 --- a/chromium/chromeos/components/nearby/library/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") - -static_library("library") { - sources = [ - "atomic_boolean.h", - "atomic_reference.h", - "byte_array.h", - "callable.h", - "cancelable.h", - "condition_variable.h", - "config.h", - "count_down_latch.h", - "down_cast.h", - "exception.h", - "executor.h", - "future.h", - "hash_utils.h", - "lock.h", - "multi_thread_executor.h", - "runnable.h", - "scheduled_executor.h", - "settable_future.h", - "single_thread_executor.h", - "submittable_executor.h", - "system_clock.h", - "thread_utils.h", - ] - - deps = [ "//base" ] -} diff --git a/chromium/chromeos/components/print_management/BUILD.gn b/chromium/chromeos/components/print_management/BUILD.gn index bd7f136ca1b..509720315ea 100644 --- a/chromium/chromeos/components/print_management/BUILD.gn +++ b/chromium/chromeos/components/print_management/BUILD.gn @@ -14,6 +14,7 @@ static_library("print_management") { deps = [ "//chromeos/components/print_management/mojom", + "//chromeos/components/web_applications", "//chromeos/constants", "//chromeos/resources:print_management_resources", "//chromeos/strings/", diff --git a/chromium/chromeos/components/print_management/mojom/printing_manager.mojom b/chromium/chromeos/components/print_management/mojom/printing_manager.mojom index 6dc89ead47d..c76e7b4f8bd 100644 --- a/chromium/chromeos/components/print_management/mojom/printing_manager.mojom +++ b/chromium/chromeos/components/print_management/mojom/printing_manager.mojom @@ -15,6 +15,55 @@ enum PrintJobCompletionStatus { kPrinted }; +// Enumeration of all the possible printer error codes. The order of these enums +// must match that of chrome/browser/chromeos/printing/printer_error_codes.h +enum PrinterErrorCode { + kNoError, + kPaperJam, + kOutOfPaper, + kOutOfInk, + kDoorOpen, + kPrinterUnreachable, + kTrayMissing, + kOutputFull, + kStopped, + kFilterFailed, + kUnknownError, +}; + +// Contains information about a completed print job. Completed print jobs are +// stored to the local database. Information of this struct includes the +// completion status and error code associated with the print job. This struct +// is null for active print jobs, i.e. jobs that are currently being printed and +// are not stored in the local database. +struct CompletedPrintJobInfo { + // Corresponds to the status of the print job after it has completed. + PrintJobCompletionStatus completion_status; + + // Corresponds to the error code reported by the printer. + PrinterErrorCode printer_error_code; +}; + +// Enumeration of ongoing print job status. +enum ActivePrintJobState { + // Print job is currently being printed. + kStarted, + + // The print job's document is considered finished to the printer. + // This includes successful, failed, and cancelled print jobs. + kDocumentDone, +}; + +// Contains all relevant information in regards to an active print job i.e. one +// that is current being printed. +struct ActivePrintJobInfo { + // Number of current printed pages. + uint32 printed_pages; + + // Current state of the print job. + ActivePrintJobState active_state; +}; + // Contains all the information in regards to a print job. Information is // provided by the printer. Printer details, i.e. name and uri, can be edited // via print settings. @@ -25,10 +74,6 @@ struct PrintJobInfo { // Title of the print job. Usually the name of the printed file. mojo_base.mojom.String16 title; - // Corresponds to the status of the print job after it the print job has - // finished. - PrintJobCompletionStatus completion_status; - // Time of when the print job was requested. mojo_base.mojom.Time creation_time; @@ -40,6 +85,24 @@ struct PrintJobInfo { // The URI of the printer the print job was requested to. url.mojom.Url printer_uri; + + // Information of a completed print job. Null struct if the print job is + // currently being printed. + CompletedPrintJobInfo? completed_info; + + // Contains information relevant to an active print job. Null struct if + // the print job is from the local database. + ActivePrintJobInfo? active_print_job_info; +}; + +// Observer interface that sends remote updates to the print management app UI +// receiver. +interface PrintJobsObserver { + // Notifies that the local print job database has been cleared. + OnAllPrintJobsDeleted(); + + // Notifies that an ongoing print job has been updated. + OnPrintJobUpdate(PrintJobInfo print_job); }; // Provides APIs to retrieve print metadata information. This API is exposed @@ -47,6 +110,13 @@ struct PrintJobInfo { // implemented by a browser service. Interacts with PrintHistory API to retrieve // print job metadatas. interface PrintingMetadataProvider { + // Takes in a remote so that the implementer binds it and send notifications + // to the receiver in the print management app. This is to set up automatic + // updates from the browser process to the renderer process. + // (print management app UI). This is guaranteed to not send remote updates + // to disconnected receivers. + ObservePrintJobs(pending_remote<PrintJobsObserver> observer) => (); + // Returns an array of PrintJobInfo. This is the main function to retrieve // the print history of a device. GetPrintJobs() => (array<PrintJobInfo> print_jobs); @@ -55,4 +125,14 @@ interface PrintingMetadataProvider { // print jobs was successful. Returns false if there was an error with // retrieving the print jobs to delete in this device. DeleteAllPrintJobs() => (bool success); + + // Cancels an ongoing print job keyed by PrintJobInfo.id. + // This is a best effort attempt as there is no guarantee that we can cancel + // a print job. Returns true if cancelling the print job was attempted. + // Returns false if cancelling the print job was not attempted. + CancelPrintJob(string id) => (bool attempted_cancel); + + // Returns true if the user is allowed to delete their own print job history + // (default value is true for non-managed users). + GetDeletePrintJobHistoryAllowedByPolicy() => (bool is_allowed_by_policy); }; diff --git a/chromium/chromeos/components/print_management/resources/BUILD.gn b/chromium/chromeos/components/print_management/resources/BUILD.gn index 7d0f5cc9ab5..8b28696840b 100644 --- a/chromium/chromeos/components/print_management/resources/BUILD.gn +++ b/chromium/chromeos/components/print_management/resources/BUILD.gn @@ -17,10 +17,19 @@ js_type_check("closure_compile_module") { ] } +js_library("icons") { + deps = [ + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] +} + js_library("print_job_entry") { deps = [ + ":icons", "//chromeos/components/print_management/mojom:mojom_js_library_for_compile", + "//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js/cr/ui:focus_row_behavior.m", ] @@ -33,7 +42,9 @@ js_library("print_management") { ":print_job_entry", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", + "//ui/webui/resources/cr_elements/policy:cr_policy_indicator.m", "//ui/webui/resources/js:i18n_behavior.m", + "//ui/webui/resources/js:load_time_data.m", ] } @@ -54,6 +65,12 @@ js_library("mojo_interface_provider") { ] } +polymer_modulizer("icons") { + js_file = "icons.js" + html_file = "icons.html" + html_type = "v3-ready" +} + polymer_modulizer("print_management") { js_file = "print_management.js" html_file = "print_management.html" @@ -72,6 +89,12 @@ polymer_modulizer("print_management_shared_css") { html_type = "v3-ready" } +polymer_modulizer("print_management_fonts_css") { + html_file = "print_management_fonts_css.html" + js_file = "print_management_fonts_css.js" + html_type = "v3-ready" +} + polymer_modulizer("print_job_clear_history_dialog") { html_file = "print_job_clear_history_dialog.html" js_file = "print_job_clear_history_dialog.js" @@ -86,8 +109,10 @@ polymer_modulizer("scanning_page") { group("polymer3_elements") { public_deps = [ + ":icons_module", ":print_job_clear_history_dialog_module", ":print_job_entry_module", + ":print_management_fonts_css_module", ":print_management_module", ":print_management_shared_css_module", ":scanning_page_module", diff --git a/chromium/chromeos/components/quick_answers/BUILD.gn b/chromium/chromeos/components/quick_answers/BUILD.gn index f64155a071a..2a50aa1ac0a 100644 --- a/chromium/chromeos/components/quick_answers/BUILD.gn +++ b/chromium/chromeos/components/quick_answers/BUILD.gn @@ -39,6 +39,7 @@ source_set("quick_answers") { "//base", "//chromeos/components/quick_answers/public/cpp:prefs", "//chromeos/constants:constants", + "//chromeos/services/assistant/public/shared", "//chromeos/services/machine_learning/public/cpp", "//chromeos/services/machine_learning/public/mojom", "//components/prefs:prefs", @@ -76,6 +77,7 @@ source_set("unit_tests") { "//base/test:test_support", "//chromeos/components/quick_answers/public/cpp:prefs", "//chromeos/constants:constants", + "//chromeos/services/assistant/public/shared", "//chromeos/services/machine_learning/public/cpp:test_support", "//chromeos/services/machine_learning/public/mojom", "//components/prefs:prefs", diff --git a/chromium/chromeos/components/string_matching/BUILD.gn b/chromium/chromeos/components/string_matching/BUILD.gn new file mode 100644 index 00000000000..0080ca90102 --- /dev/null +++ b/chromium/chromeos/components/string_matching/BUILD.gn @@ -0,0 +1,62 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//testing/libfuzzer/fuzzer_test.gni") + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +source_set("string_matching") { + sources = [ + "fuzzy_tokenized_string_match.cc", + "fuzzy_tokenized_string_match.h", + "prefix_matcher.cc", + "prefix_matcher.h", + "sequence_matcher.cc", + "sequence_matcher.h", + "term_break_iterator.cc", + "term_break_iterator.h", + "tokenized_string.cc", + "tokenized_string.h", + "tokenized_string_char_iterator.cc", + "tokenized_string_char_iterator.h", + "tokenized_string_match.cc", + "tokenized_string_match.h", + ] + + deps = [ + "//base:i18n", + "//cc", + ] + + public_deps = [ + "//base", + "//ui/gfx", + ] +} + +source_set("unit_tests") { + testonly = true + + sources = [ + "fuzzy_tokenized_string_match_unittest.cc", + "sequence_matcher_unittest.cc", + "term_break_iterator_unittest.cc", + "tokenized_string_char_iterator_unittest.cc", + "tokenized_string_match_unittest.cc", + "tokenized_string_unittest.cc", + ] + + deps = [ + ":string_matching", + "//testing/gtest", + ] +} + +fuzzer_test("tokenized_string_fuzzer") { + sources = [ "tokenized_string_fuzzer.cc" ] + deps = [ + ":string_matching", + "//base", + ] +} diff --git a/chromium/chromeos/components/telemetry_extension_ui/BUILD.gn b/chromium/chromeos/components/telemetry_extension_ui/BUILD.gn new file mode 100644 index 00000000000..26b6fe998a7 --- /dev/null +++ b/chromium/chromeos/components/telemetry_extension_ui/BUILD.gn @@ -0,0 +1,49 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_chromeos, "Telemetry Extension is Chrome OS only") +assert(!is_official_build, + "Telemetry Extension is only built for unofficial builds") + +source_set("telemetry_extension_ui") { + sources = [ + "probe_service.cc", + "probe_service.h", + "probe_service_converters.cc", + "probe_service_converters.h", + "telemetry_extension_ui.cc", + "telemetry_extension_ui.h", + "url_constants.cc", + "url_constants.h", + ] + + deps = [ + "//base", + "//chromeos/components/telemetry_extension_ui/mojom", + "//chromeos/constants", + "//chromeos/resources:telemetry_extension_resources", + "//chromeos/services/cros_healthd/public/cpp", + "//chromeos/services/cros_healthd/public/mojom", + "//content/public/browser", + "//ui/webui", + ] +} + +source_set("unit_tests") { + testonly = true + sources = [ + "probe_service_converters_unittest.cc", + "probe_service_unittest.cc", + ] + deps = [ + ":telemetry_extension_ui", + "//base", + "//base/test:test_support", + "//chromeos/components/telemetry_extension_ui/mojom", + "//chromeos/dbus/cros_healthd", + "//chromeos/services/cros_healthd/public/mojom", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/chromium/chromeos/components/telemetry_extension_ui/mojom/BUILD.gn b/chromium/chromeos/components/telemetry_extension_ui/mojom/BUILD.gn new file mode 100644 index 00000000000..9abf3befe7f --- /dev/null +++ b/chromium/chromeos/components/telemetry_extension_ui/mojom/BUILD.gn @@ -0,0 +1,9 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ "probe_service.mojom" ] +} diff --git a/chromium/chromeos/components/telemetry_extension_ui/mojom/probe_service.mojom b/chromium/chromeos/components/telemetry_extension_ui/mojom/probe_service.mojom new file mode 100644 index 00000000000..8a9d5f76c5f --- /dev/null +++ b/chromium/chromeos/components/telemetry_extension_ui/mojom/probe_service.mojom @@ -0,0 +1,146 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// cros_healthd daemon implements ProbeService interface, but since callers are +// third-party Telemetry Extensions, we have PII filtering and data post +// processing service in the middle that lives in Chrome. + +// Currently we expose this interface to WebUI only in Chrome OS and on +// non-official builds so that we can prototype Telemetry Extension, while we +// decide how to expose API to third parties. + +// This Mojo interface will go through security review before shipping. + +// This is a subset of the cros_healthd probe service interface which is +// located in src/platform2/diagnostics/mojo/cros_healthd_probe.mojom. +// +// What is different: +// 1) Introduced DoubleValue and Int64Value structs since numeric primitives +// are not nullable in Mojo. +// 2) Make all fields in BatteryInfo optional in case we want to filter them +// out later. + +module chromeos.health.mojom; + +// Interface for getting device telemetry information. +interface ProbeService { + // Returns telemetry information for the desired categories. + // + // The request: + // * |categories| - list of each of the categories that ProbeTelemetryInfo + // should return information for. + // + // The response: + // * |telemetry_info| - information for each of the requested categories. Only + // the fields corresponding to the requested categories + // will be non-null. + ProbeTelemetryInfo(array<ProbeCategoryEnum> categories) + => (TelemetryInfo telemetry_info); +}; + +// An enumeration of each category of information that cros_healthd can report. +[Extensible] +enum ProbeCategoryEnum { + kBattery, +}; + +// An enumeration of the different categories of errors that can occur when +// probing telemetry information. +[Extensible] +enum ErrorType { + // An error reading a system file. + kFileReadError, + // An error parsing data into a consumable form. + kParseError, + // An error using a system utility. + kSystemUtilityError, +}; + +// Structure that contains error information for a telemetry probe. +struct ProbeError { + // The type of error that occurred. + ErrorType type; + // A debug message with more information about the error. This string is not + // intended to be shown to the user. + string msg; +}; + +// Optional double field. Since primitives numeric types cannot be optional, +// wrap double in a struct that can be nulled. +struct DoubleValue { + // The value of the double. + double value; +}; + +// Optional int64 field. Since primitives numeric types cannot be optional, +// wrap int64 in a struct that can be nulled. +struct Int64Value { + // The value of the int64. + int64 value; +}; + +// Optional uint64 field. Since primitives numeric types cannot be optional, +// wrap uint64 in a struct that can be nulled. +struct UInt64Value { + // The value of the uint64. + uint64 value; +}; + +// Information related to the main battery. +struct BatteryInfo { + // Cycle count. + Int64Value? cycle_count; + // Current battery voltage (V) + DoubleValue? voltage_now; + // Manufacturer of the battery + string? vendor; + // Serial number of the battery + string? serial_number; + // Design capacity (Ah) + DoubleValue? charge_full_design; + // Full capacity (Ah) + DoubleValue? charge_full; + // Desired minimum output voltage (V) + DoubleValue? voltage_min_design; + // Model name. + string? model_name; + // Current battery charge (Ah) + DoubleValue? charge_now; + // Current battery current (A) + DoubleValue? current_now; + // Technology of the battery + string? technology; + // Status of the battery + string? status; + + // The fields below are optionally included if the main battery is a Smart + // Battery as defined in http://sbs-forum.org/specs/sbdat110.pdf. + + // Manufacture date converted to yyyy-mm-dd format. + string? manufacture_date; + // Temperature in 0.1K. Included when the main battery is a Smart Battery. + UInt64Value? temperature; +}; + +// Battery probe result. Can either be populated with the BatteryInfo or an +// error retrieving the information. +union BatteryResult { + // Valid BatteryInfo. Null value if a battery is not present. + BatteryInfo? battery_info; + // The error that occurred attempting to retrieve the BatteryInfo. + ProbeError error; +}; + +// A collection of all the device's telemetry information that cros_healthd is +// capable of reporting. Note that every field in TelemetryInfo is nullable, and +// the response for a particular ProbeTelemetryInfo request will only contain +// fields corresponding to the categories passed to the ProbeTelemetryInfo +// request. All optional array members will be null if cros_healthd did not +// attempt to fetch that information, and size zero if cros_healthd did attempt +// to fetch that information, but was unable to. +struct TelemetryInfo { + // Information about the device's main battery. Only present when kBattery was + // included in the categories input to ProbeTelemetryInfo. + BatteryResult? battery_result; +}; diff --git a/chromium/chromeos/components/telemetry_extension_ui/resources/BUILD.gn b/chromium/chromeos/components/telemetry_extension_ui/resources/BUILD.gn new file mode 100644 index 00000000000..a21a58de8a1 --- /dev/null +++ b/chromium/chromeos/components/telemetry_extension_ui/resources/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +assert(is_chromeos, "Telemetry Extension is Chrome OS only") +assert(!is_official_build, + "Telemetry Extension is only built for unofficial builds") + +js_type_check("closure_compile") { + deps = [ + ":trusted", + ":untrusted", + ":untrusted_worker", + ] +} + +js_library("trusted") { + sources = [ "trusted.js" ] + deps = [ "../mojom:mojom_js_library_for_compile" ] +} + +js_library("untrusted") { + sources = [ "untrusted.js" ] +} + +js_library("untrusted_worker") { + sources = [ "untrusted_worker.js" ] +} diff --git a/chromium/chromeos/components/telemetry_extension_ui/test/BUILD.gn b/chromium/chromeos/components/telemetry_extension_ui/test/BUILD.gn new file mode 100644 index 00000000000..b0cfce2f398 --- /dev/null +++ b/chromium/chromeos/components/telemetry_extension_ui/test/BUILD.gn @@ -0,0 +1,17 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//chrome/test/base/js2gtest.gni") + +assert(is_chromeos, "Telemetry Extension is Chrome OS only") +assert(!is_official_build, + "Telemetry Extension is only built for unofficial builds") + +js2gtest("browser_tests_js") { + test_type = "mojo_lite_webui" + + sources = [ "telemetry_extension_ui_browsertest.js" ] + + defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] +} diff --git a/chromium/chromeos/dbus/BUILD.gn b/chromium/chromeos/dbus/BUILD.gn index 713a31bc17a..2da0820b1fd 100644 --- a/chromium/chromeos/dbus/BUILD.gn +++ b/chromium/chromeos/dbus/BUILD.gn @@ -24,8 +24,10 @@ component("dbus") { ] deps = [ ":anomaly_detector_proto", + ":chunneld_proto", ":cicerone_proto", ":concierge_proto", + ":lorgnette_proto", ":metrics_event_proto", ":oobe_config_proto", ":plugin_vm_service_proto", @@ -34,6 +36,7 @@ component("dbus") { ":smbprovider_proto", ":update_engine_proto", ":vm_applications_apps_proto", + ":vm_permission_service_proto", ":vm_plugin_dispatcher_proto", "//base", "//components/account_id", @@ -55,10 +58,10 @@ component("dbus") { "arc_midis_client.h", "arc_obb_mounter_client.cc", "arc_obb_mounter_client.h", - "arc_oemcrypto_client.cc", - "arc_oemcrypto_client.h", "cec_service_client.cc", "cec_service_client.h", + "chunneld_client.cc", + "chunneld_client.h", "cicerone_client.cc", "cicerone_client.h", "concierge_client.cc", @@ -84,10 +87,10 @@ component("dbus") { "fake_arc_midis_client.h", "fake_arc_obb_mounter_client.cc", "fake_arc_obb_mounter_client.h", - "fake_arc_oemcrypto_client.cc", - "fake_arc_oemcrypto_client.h", "fake_cec_service_client.cc", "fake_cec_service_client.h", + "fake_chunneld_client.cc", + "fake_chunneld_client.h", "fake_cicerone_client.cc", "fake_cicerone_client.h", "fake_concierge_client.cc", @@ -211,6 +214,7 @@ source_set("unit_tests") { "//chromeos/dbus/cryptohome", "//chromeos/dbus/cryptohome:attestation_proto", "//chromeos/dbus/dlcservice:test_support", + "//chromeos/dbus/hermes:test_support", "//chromeos/dbus/ip_peripheral:test_support", "//chromeos/dbus/power:power_manager_proto", "//chromeos/dbus/power:test_support", @@ -250,6 +254,13 @@ proto_library("anomaly_detector_proto") { proto_out_dir = "chromeos/dbus/anomaly_detector" } +proto_library("chunneld_proto") { + sources = + [ "//third_party/cros_system_api/dbus/chunneld/chunneld_service.proto" ] + + proto_out_dir = "chromeos/dbus/chunneld" +} + proto_library("cicerone_proto") { sources = [ "//third_party/cros_system_api/dbus/vm_cicerone/cicerone_service.proto", @@ -266,6 +277,13 @@ proto_library("concierge_proto") { proto_out_dir = "chromeos/dbus/concierge" } +proto_library("lorgnette_proto") { + sources = + [ "//third_party/cros_system_api/dbus/lorgnette/lorgnette_service.proto" ] + + proto_out_dir = "chromeos/dbus/lorgnette" +} + proto_library("metrics_event_proto") { sources = [ "//third_party/cros_system_api/dbus/metrics_event/metrics_event.proto" ] @@ -324,6 +342,12 @@ proto_library("vm_applications_apps_proto") { proto_out_dir = "chromeos/dbus/vm_applications" } +proto_library("vm_permission_service_proto") { + sources = [ "//third_party/cros_system_api/dbus/vm_permission_service/vm_permission_service.proto" ] + + proto_out_dir = "chromeos/dbus/vm_permission_service" +} + proto_library("vm_plugin_dispatcher_proto") { sources = [ "//third_party/cros_system_api/dbus/vm_plugin_dispatcher/vm_plugin_dispatcher.proto" ] diff --git a/chromium/chromeos/dbus/attestation/BUILD.gn b/chromium/chromeos/dbus/attestation/BUILD.gn new file mode 100644 index 00000000000..c8fdf7d2ebf --- /dev/null +++ b/chromium/chromeos/dbus/attestation/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/protobuf/proto_library.gni") + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("attestation") { + output_name = "chromeos_dbus_attestation" + defines = [ "IS_CHROMEOS_DBUS_ATTESTATION_IMPL" ] + + deps = [ + ":attestation_proto", + "//base", + "//dbus", + ] + + sources = [ + "attestation_client.cc", + "attestation_client.h", + "fake_attestation_client.cc", + "fake_attestation_client.h", + ] +} + +proto_library("attestation_proto") { + sources = [ + "//third_party/cros_system_api/dbus/attestation/attestation_ca.proto", + "//third_party/cros_system_api/dbus/attestation/interface.proto", + "//third_party/cros_system_api/dbus/attestation/keystore.proto", + ] + + proto_out_dir = "chromeos/dbus/attestation" +} diff --git a/chromium/chromeos/dbus/cdm_factory_daemon/BUILD.gn b/chromium/chromeos/dbus/cdm_factory_daemon/BUILD.gn new file mode 100644 index 00000000000..3fbfde27583 --- /dev/null +++ b/chromium/chromeos/dbus/cdm_factory_daemon/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("cdm_factory_daemon") { + defines = [ "IS_CDM_FACTORY_DAEMON_IMPL" ] + + deps = [ + "//base", + "//dbus", + ] + + sources = [ + "cdm_factory_daemon_client.cc", + "cdm_factory_daemon_client.h", + "fake_cdm_factory_daemon_client.cc", + "fake_cdm_factory_daemon_client.h", + ] +} diff --git a/chromium/chromeos/dbus/hermes/BUILD.gn b/chromium/chromeos/dbus/hermes/BUILD.gn new file mode 100644 index 00000000000..3bfaaf3bc97 --- /dev/null +++ b/chromium/chromeos/dbus/hermes/BUILD.gn @@ -0,0 +1,72 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("hermes") { + public_deps = [ ":hermes_clients" ] + deps = [ ":hermes_fakes" ] +} + +source_set("hermes_clients") { + defines = [ "IS_HERMES_CLIENT_IMPL" ] + deps = [ + "//base", + "//chromeos/dbus:common", + "//components/device_event_log", + "//dbus", + ] + + sources = [ + "hermes_clients.cc", + "hermes_clients.h", + "hermes_manager_client.cc", + "hermes_manager_client.h", + "hermes_profile_client.cc", + "hermes_profile_client.h", + "hermes_response_status.cc", + "hermes_response_status.h", + ] +} + +source_set("hermes_fakes") { + deps = [ + ":hermes_clients", + "//base", + "//chromeos/dbus/constants", + "//chromeos/dbus/shill", + "//dbus", + ] + + sources = [ + "fake_hermes_manager_client.cc", + "fake_hermes_manager_client.h", + "fake_hermes_profile_client.cc", + "fake_hermes_profile_client.h", + ] + + allow_circular_includes_from = [ ":hermes_clients" ] +} + +source_set("test_support") { + testonly = true + public_deps = [ ":hermes" ] + deps = [ + "//base", + "//base/test:test_support", + "//chromeos/dbus:common", + "//dbus:test_support", + "//testing/gmock", + "//testing/gtest", + ] + + sources = [ + "hermes_client_test_base.cc", + "hermes_client_test_base.h", + "hermes_manager_client_unittest.cc", + "hermes_profile_client_unittest.cc", + "hermes_test_utils.cc", + "hermes_test_utils.h", + ] +} diff --git a/chromium/chromeos/lacros/browser/BUILD.gn b/chromium/chromeos/lacros/browser/BUILD.gn new file mode 100644 index 00000000000..7b9b731bd45 --- /dev/null +++ b/chromium/chromeos/lacros/browser/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Reset sources_assignment_filter for the BUILD.gn file to prevent +# regression during the migration of Chromium away from the feature. +# See docs/no_sources_assignment_filter.md for more information. +# TODO(crbug.com/1018739): remove this when migration is done. +set_sources_assignment_filter([]) + +component("browser") { + defines = [ "IS_CHROMEOS_LACROS_IMPL" ] + deps = [ + "//base", + "//chromeos/lacros/mojom", + ] + sources = [ + "lacros_chrome_service_impl.cc", + "lacros_chrome_service_impl.h", + ] +} diff --git a/chromium/chromeos/lacros/mojom/BUILD.gn b/chromium/chromeos/lacros/mojom/BUILD.gn new file mode 100644 index 00000000000..567f9a9dd03 --- /dev/null +++ b/chromium/chromeos/lacros/mojom/BUILD.gn @@ -0,0 +1,9 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ "lacros.mojom" ] +} diff --git a/chromium/chromeos/lacros/mojom/lacros.mojom b/chromium/chromeos/lacros/mojom/lacros.mojom new file mode 100644 index 00000000000..5a8360c01c5 --- /dev/null +++ b/chromium/chromeos/lacros/mojom/lacros.mojom @@ -0,0 +1,22 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module lacros.mojom; + +// AshChromeService defines the APIs that live in ash-chrome and are +// accessed from lacros-chrome. +interface AshChromeService { +}; + +// LacrosChromeService defines the APIs that live in lacros-chrome and +// are accessed from ash-chrome. +interface LacrosChromeService { + // Returns the pending_receiver of AshChromeService. + // Ash-chrome is expected to call this method on initialization. + // Lacros-chrome may call AshChromeService APIs earlier than this + // invocation. In the case, the calls are queued, and processed + // sequentially, when ash-chrome binds the receiver to the service. + RequestAshChromeServiceReceiver@0() => ( + pending_receiver<AshChromeService> receiver); +}; diff --git a/chromium/chromeos/resources/BUILD.gn b/chromium/chromeos/resources/BUILD.gn index b3ba08270e5..836ddd1c0a5 100644 --- a/chromium/chromeos/resources/BUILD.gn +++ b/chromium/chromeos/resources/BUILD.gn @@ -37,6 +37,32 @@ grit("resources") { "//chromeos/services/machine_learning/public/mojom:mojom_js", "//chromeos/services/multidevice_setup/public/mojom:mojom_js", "//chromeos/services/network_config/public/mojom:mojom_js", + "//chromeos/services/network_health/public/mojom:mojom_js", + ] +} + +# Resources used by chrome://camera-app. +grit("camera_app_resources") { + source = "../components/camera_app_ui/resources/camera_app_resources.grd" + + outputs = [ + "grit/chromeos_camera_app_resources.h", + "grit/chromeos_camera_app_resources_map.cc", + "grit/chromeos_camera_app_resources_map.h", + "chromeos_camera_app_resources.pak", + ] + output_dir = "$root_gen_dir/chromeos" + + grit_flags = [ + "-E", + "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), + ] + + deps = [ + "//chromeos/components/camera_app_ui:mojo_bindings_js", + "//media/capture/video/chromeos/mojom:cros_camera_js", + "//mojo/public/js:bindings_lite", + "//third_party/blink/public/mojom:mojom_platform_js", ] } @@ -95,6 +121,27 @@ grit("sample_system_web_app_resources") { output_dir = "$root_gen_dir/chromeos" } +# Resources used by chrome://telemetry-extension +grit("telemetry_extension_resources") { + source = "../components/telemetry_extension_ui/resources/telemetry_extension_resources.grd" + + deps = [ "../components/telemetry_extension_ui/mojom:mojom_js" ] + + outputs = [ + "grit/chromeos_telemetry_extension_resources.h", + "grit/chromeos_telemetry_extension_resources_map.cc", + "grit/chromeos_telemetry_extension_resources_map.h", + "chromeos_telemetry_extension_resources.pak", + ] + + grit_flags = [ + "-E", + "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), + ] + + output_dir = "$root_gen_dir/chromeos" +} + # Resources used by chrome://media-app, and parts of the sandboxed app it hosts # that do not come from the app bundle (below). grit("media_app_resources") { @@ -119,8 +166,8 @@ grit("media_app_resources") { # Resources automatically served by the chrome://media-app bundle, obtained via DEPS. grit("media_app_bundle_resources") { if (enable_cros_media_app) { - # Obtained via src-internal/DEPS. - source = "../components/media_app_ui/resources/pkg/media_app_bundle_resources.grd" + # Obtained via an internal CIPD package in src/DEPS. + source = "../components/media_app_ui/resources/prod/media_app_bundle_resources.grd" } else { source = "../components/media_app_ui/resources/mock/media_app_bundle_mock_resources.grd" } diff --git a/chromium/chromeos/services/assistant/BUILD.gn b/chromium/chromeos/services/assistant/BUILD.gn index dc1eb5af16b..52e4387f54b 100644 --- a/chromium/chromeos/services/assistant/BUILD.gn +++ b/chromium/chromeos/services/assistant/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/buildflag_header.gni") import("//chromeos/assistant/assistant.gni") assert(is_chromeos) @@ -17,6 +18,8 @@ component("lib") { defines = [ "IS_ASSISTANT_SERVICE_IMPL" ] sources = [ + "assistant_interaction_logger.cc", + "assistant_interaction_logger.h", "assistant_manager_service.h", "fake_assistant_manager_service_impl.cc", "fake_assistant_manager_service_impl.h", @@ -41,6 +44,7 @@ component("lib") { "//components/prefs", "//components/signin/public/identity_manager", "//components/user_manager", + "//media", "//services/device/public/mojom", "//services/network/public/cpp:cpp", "//ui/accessibility:ax_assistant", @@ -101,7 +105,15 @@ component("lib") { "utils.h", ] + if (enable_fake_assistant_microphone) { + sources += [ + "platform/fake_input_device.cc", + "platform/fake_input_device.h", + ] + } + deps += [ + ":buildflags", "//chromeos/assistant/internal", "//chromeos/assistant/internal:libassistant", "//chromeos/assistant/internal/proto/google3", @@ -128,6 +140,7 @@ source_set("tests") { testonly = true deps = [ ":lib", + ":test_support", "//ash/public/cpp/assistant/test_support", "//ash/public/mojom", "//base", @@ -175,8 +188,6 @@ source_set("tests") { "test_support/fake_platform_api.h", "test_support/fake_service_context.cc", "test_support/fake_service_context.h", - "test_support/mock_assistant_interaction_subscriber.cc", - "test_support/mock_assistant_interaction_subscriber.h", "test_support/mock_media_manager.cc", "test_support/mock_media_manager.h", ] @@ -190,6 +201,7 @@ source_set("tests") { "//chromeos/services/network_config/public/mojom", "//services/audio/public/cpp:test_support", "//services/device/public/cpp:test_support", + "//services/media_session/public/mojom", ] } } @@ -199,6 +211,8 @@ static_library("test_support") { sources = [ "test_support/mock_assistant.cc", "test_support/mock_assistant.h", + "test_support/mock_assistant_interaction_subscriber.cc", + "test_support/mock_assistant_interaction_subscriber.h", ] deps = [ "//base", @@ -208,3 +222,10 @@ static_library("test_support") { "//testing/gmock", ] } + +buildflag_header("buildflags") { + header = "buildflags.h" + + flags = + [ "ENABLE_FAKE_ASSISTANT_MICROPHONE=$enable_fake_assistant_microphone" ] +} diff --git a/chromium/chromeos/services/assistant/public/cpp/BUILD.gn b/chromium/chromeos/services/assistant/public/cpp/BUILD.gn index 55a3a38f401..55789f29380 100644 --- a/chromium/chromeos/services/assistant/public/cpp/BUILD.gn +++ b/chromium/chromeos/services/assistant/public/cpp/BUILD.gn @@ -18,17 +18,22 @@ component("cpp") { "assistant_service.h", "assistant_settings.cc", "assistant_settings.h", - "default_assistant_interaction_subscriber.cc", - "default_assistant_interaction_subscriber.h", "device_actions.cc", "device_actions.h", "features.cc", "features.h", ] - deps = [ + public_deps = [ + "//ash/public/mojom", + "//chromeos/constants:constants", "//chromeos/services/assistant/public/mojom", - "//components/prefs", - "//mojo/public/cpp/bindings", + "//chromeos/services/network_config/public/mojom", + "//services/audio/public/mojom", + "//services/device/public/mojom", + "//services/media_session/public/mojom", + "//ui/accessibility/mojom", ] + + deps = [ "//components/prefs" ] } diff --git a/chromium/chromeos/services/assistant/public/mojom/BUILD.gn b/chromium/chromeos/services/assistant/public/mojom/BUILD.gn index 4f516d4a3a1..026d8b048f4 100644 --- a/chromium/chromeos/services/assistant/public/mojom/BUILD.gn +++ b/chromium/chromeos/services/assistant/public/mojom/BUILD.gn @@ -5,26 +5,9 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { - sources = [ - "assistant.mojom", - "assistant_audio_decoder.mojom", - ] - - public_deps = [ - ":notification", - "//ash/public/mojom", - "//chromeos/services/network_config/public/mojom", - "//mojo/public/mojom/base", - "//services/audio/public/mojom", - "//services/device/public/mojom", - "//services/media_session/public/mojom", - "//ui/accessibility/mojom", - "//ui/gfx/geometry/mojom", - "//url/mojom:url_mojom_gurl", - ] + sources = [ "assistant_audio_decoder.mojom" ] - # Ash mojom disables variants, so its dependents must do the same. - disable_variants = true + public_deps = [ ":notification" ] } # This dependency is separated to avoid circular dependencies between the above diff --git a/chromium/chromeos/services/assistant/public/mojom/assistant.mojom b/chromium/chromeos/services/assistant/public/mojom/assistant.mojom deleted file mode 100644 index 3bedfaadbde..00000000000 --- a/chromium/chromeos/services/assistant/public/mojom/assistant.mojom +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module chromeos.assistant.mojom; - -import "ash/public/mojom/assistant_controller.mojom"; -import "ash/public/mojom/assistant_volume_control.mojom"; -import "chromeos/services/assistant/public/mojom/assistant_audio_decoder.mojom"; -import "chromeos/services/assistant/public/mojom/assistant_notification.mojom"; -import "chromeos/services/network_config/public/mojom/cros_network_config.mojom"; -import "mojo/public/mojom/base/string16.mojom"; -import "mojo/public/mojom/base/time.mojom"; -import "mojo/public/mojom/base/unguessable_token.mojom"; -import "services/audio/public/mojom/stream_factory.mojom"; -import "services/device/public/mojom/battery_monitor.mojom"; -import "services/device/public/mojom/wake_lock_provider.mojom"; -import "services/media_session/public/mojom/audio_focus.mojom"; -import "services/media_session/public/mojom/media_controller.mojom"; -import "ui/accessibility/mojom/ax_assistant_structure.mojom"; -import "ui/gfx/geometry/mojom/geometry.mojom"; -import "url/mojom/url.mojom"; - -// Interface to communicate with assistant backend. -// The Assistant instance is held by chromeos::assistant::Service, which is -// hosted in the browser process. -// The callers are mostly in ash, and some are in autotest. -interface Assistant { - // Starts an interaction to edit the reminder uniquely identified by - // |client_id|. In response to the request, LibAssistant will initiate - // a user facing interaction with the context pre-populated with details - // to edit the specified reminder. - StartEditReminderInteraction(string client_id); - - // Starts a screen context interaction. Results related to the screen context - // will be returned through the |AssistantInteractionSubscriber| interface to - // registered subscribers. - // |assistant_screenshot| contains JPEG data. - StartScreenContextInteraction( - ax.mojom.AssistantStructure? assistant_structure, - array<uint8> assistant_screenshot); - - // Starts a new Assistant text interaction. If |allow_tts| is true, the - // result will contain TTS. Otherwise TTS will not be present in the - // generated server response. Results will be returned through registered - // |AssistantInteractionSubscriber|. - StartTextInteraction( - string query, AssistantQuerySource source, bool allow_tts); - - // Starts a new Assistant voice interaction. - StartVoiceInteraction(); - - // Starts a warmer welcome interaction for Assistant launch. - // |num_warmer_welcome_triggered| is the count of warmer welcomes - // already triggered. If |allow_tts| is true, the result may contain TTS. - // Otherwise TTS will not be present in the generated server response. - StartWarmerWelcomeInteraction(int32 num_warmer_welcome_triggered, - bool allow_tts); - - // Stops the active Assistant interaction and cancel the conversation if - // |cancel_conversation|. If there is no active interaction, this method - // is a no-op. - StopActiveInteraction(bool cancel_conversation); - - // Registers assistant interaction event subscriber. Subscribers' - // implementation is responsible for selecting events of interest. - AddAssistantInteractionSubscriber( - pending_remote<AssistantInteractionSubscriber> subscriber); - - // Retrieves a notification. A voiceless interaction will be sent to server to - // retrieve the notification of |action_index|, which can trigger other - // Assistant events such as OnTextResponse to show the result in the UI. The - // retrieved notification will be removed from the UI. - // |action_index| is the index of the tapped action. The main UI in the - // notification contains the top level action, which index is 0. The buttons - // have the additional actions, which are indexed starting from 1. - RetrieveNotification(AssistantNotification notification, int32 action_index); - - // Dismisses a notification. - DismissNotification(AssistantNotification notification); - - // Invoked when accessibility status is changed. Note that though - // accessibility status has changed, |spoken_feedback_enabled| may not have. - OnAccessibilityStatusChanged(bool spoken_feedback_enabled); - - // Send Assistant feedback to Assistant server. - SendAssistantFeedback(AssistantFeedback feedback); - - // Invoked on entry to Assistant UI. - NotifyEntryIntoAssistantUi(AssistantEntryPoint entry_point); - - // Alarm/Timer methods ------------------------------------------------------- - - // Adds the specified |duration| to the timer identified by |id|. Note that - // this method is a no-op if there is no existing timer identified by |id|. - AddTimeToTimer(string id, mojo_base.mojom.TimeDelta duration); - - // Pauses the timer specified by |id|. Note that this method is a no-op if - // there is no existing timer identified by |id| or if a timer does exist but - // is already paused. - PauseTimer(string id); - - // Remove the alarm/timer specified by |id|. - // NOTE: this is a no-op if no such alarm/timer exists. - RemoveAlarmOrTimer(string id); - - // Resumes the timer specified by |id|. Note that this method is a no-op if - // there is no existing timer identified by |id| or if a timer does exist but - // isn't currently paused. - ResumeTimer(string id); -}; - -// Enumeration of Assistant entry points. These values are persisted to logs. -// Entries should not be renumbered and numeric values should never be reused. -// Only append to this enum is allowed if the possible entry source grows. -enum AssistantEntryPoint { - kUnspecified = 0, - kDeepLink = 1, - kHotkey = 2, - kHotword = 3, - // kLauncherSearchBoxDeprecated = 4, - kLongPressLauncher = 5, - kSetup = 6, - kStylus = 7, - kLauncherSearchResult = 8, - kLauncherSearchBoxIcon = 9, - kProactiveSuggestions = 10, - kLauncherChip = 11, -}; - -// Enumeration of Assistant exit points. These values are persisted to logs. -// Entries should not be renumbered and numeric values should never be reused. -// Only append to this enum is allowed if the possible exit source grows. -enum AssistantExitPoint { - // Includes keyboard interruptions (e.g. launching Chrome OS feedback - // using keyboard shortcuts, pressing search button). - kUnspecified = 0, - kCloseButton = 1, - kHotkey = 2, - kNewBrowserTabFromServer = 3, - kNewBrowserTabFromUser = 4, - kOutsidePress = 5, - kSetup = 6, - kStylus = 7, - kBackInLauncher = 8, - kLauncherClose = 9, - kLauncherOpen = 10, - kScreenshot = 11, - kOverviewMode = 12, -}; - -// Describes an Assistant interaction. -struct AssistantInteractionMetadata { - AssistantInteractionType type; - AssistantQuerySource source; - string query; -}; - -// Enumeration of possible Assistant interaction types. -enum AssistantInteractionType { - kText, - kVoice, -}; - -// Enumeration of possible Assistant query sources. These values are persisted -// to logs. Entries should not be renumbered and numeric values should never -// be reused. Append new values to the end. -enum AssistantQuerySource { - kUnspecified = 0, - kDeepLink = 1, - kDialogPlateTextField = 2, - kStylus = 3, - kSuggestionChip = 4, - kVoiceInput = 5, - kProactiveSuggestions = 6, - kLibAssistantInitiated = 7, - kWarmerWelcome = 8, - kConversationStarter = 9, - kWhatsOnMyScreen = 10, - kQuickAnswers = 11, - kLauncherChip = 12, -}; - -// Subscribes to Assistant's interaction event. These events are server driven -// in response to the user's direct interaction with the assistant. Responses -// from the assistant may contain untrusted third-party content. Subscriber -// implementations must be sure to handle the response data appropriately. -interface AssistantInteractionSubscriber { - // Assistant interaction has started. - OnInteractionStarted(AssistantInteractionMetadata metadata); - - // Assistant interaction has ended with the specified |resolution|. - OnInteractionFinished(AssistantInteractionResolution resolution); - - // Assistant got Html response with fallback text from server. - OnHtmlResponse(string response, string fallback); - - // Assistant got suggestions response from server. - OnSuggestionsResponse(array<AssistantSuggestion> response); - - // Assistant got text response from server. - OnTextResponse(string response); - - // Assistant got open URL response from server. |in_background| refers to - // being in background of Assistant UI, not in background of browser. - OnOpenUrlResponse(url.mojom.Url url, bool in_background); - - // Assistant got open Android app response from server. - OnOpenAppResponse(AndroidAppInfo app_info) => (bool app_opened); - - // Assistant speech recognition has started. - OnSpeechRecognitionStarted(); - - // Assistant speech recognition intermediate result is available. - OnSpeechRecognitionIntermediateResult(string high_confidence_text, - string low_confidence_text); - - // Assistant speech recognition detected end of utterance. - OnSpeechRecognitionEndOfUtterance(); - - // Assistant speech recognition final result is available. - OnSpeechRecognitionFinalResult(string final_result); - - // Assistant got an instantaneous speech level update in dB. - OnSpeechLevelUpdated(float speech_level); - - // Assistant has started speaking. When TTS is started due to an error that - // occurred during the interaction, |due_to_error| is true. - OnTtsStarted(bool due_to_error); - - // Assistant has started waiting. This occur during execution of a routine to - // give the user time to digest a response before continuing execution. - OnWaitStarted(); -}; - -// Enumeration of possible completions for an Assistant interaction. -enum AssistantInteractionResolution { - // Assistant interaction completed normally. - kNormal, - // Assistant interaction completed due to barge in or cancellation. - kInterruption, - // Assistant interaction completed due to error. - kError, - // Assistant interaction completed due to mic timeout. - kMicTimeout, - // Assistant interaction completed due to multi-device hotword loss. - kMultiDeviceHotwordLoss, -}; - -// Enumeration of possible Assistant suggestion types. -enum AssistantSuggestionType { - kUnspecified, - kConversationStarter, -}; - -// Models an Assistant suggestion. -struct AssistantSuggestion { - // Uniquely identifies a given suggestion. - mojo_base.mojom.UnguessableToken id; - - // Allows us to differentiate between a typical Assistant suggestion and an - // Assistant suggestion of another type (e.g. a conversation starter). - AssistantSuggestionType type = kUnspecified; - - // Display text. e.g. "Cancel". - string text; - - // Optional URL for icon. e.g. "https://www.gstatic.com/icon.png". - url.mojom.Url icon_url; - - // Optional URL for action. e.g. - // "https://www.google.com/search?query=action". - url.mojom.Url action_url; -}; - -// Models status of an app. -enum AppStatus { UNKNOWN, AVAILABLE, UNAVAILABLE, VERSION_MISMATCH, DISABLED }; - -// Models an Android app. -struct AndroidAppInfo { - // Unique name to identify a specific app. - string package_name; - - // Version number of the app. - int32 version; - - // Localized app name. - string localized_app_name; - - // Intent data to operate on. - string intent; - - // Status of the app. - AppStatus status; - - // The general action to be performed, such as ACTION_VIEW, ACTION_MAIN, etc. - string action; -}; - -// Details for Assistant feedback. -struct AssistantFeedback { - // User input to be sent with the feedback report. - string description; - - // Whether user consent to send debug info. - bool assistant_debug_info_allowed; - - // Screenshot if allowed by user. - // Raw data (non-encoded binary octets) - string screenshot_png; -}; diff --git a/chromium/chromeos/services/assistant/public/mojom/assistant_notification.mojom b/chromium/chromeos/services/assistant/public/mojom/assistant_notification.mojom index 0ddfe4b1c08..e10f8f61360 100644 --- a/chromium/chromeos/services/assistant/public/mojom/assistant_notification.mojom +++ b/chromium/chromeos/services/assistant/public/mojom/assistant_notification.mojom @@ -7,16 +7,6 @@ module chromeos.assistant.mojom; import "mojo/public/mojom/base/time.mojom"; import "url/mojom/url.mojom"; -// TODO(b:153495778): Remove notification types. -// Enumeration of notification types. -enum AssistantNotificationType { - // A notification of type |kSystem| will only be displayed within the Message - // Center. It is immediately added to the Message Center regardless of - // Assistant UI visibility state, although it may not be added if the user has - // opted out of seeing system notifications. - kSystem, -}; - // Models a notification button. struct AssistantNotificationButton { // Display text of the button. @@ -24,13 +14,21 @@ struct AssistantNotificationButton { // Optional URL to open when the tap action is invoked on the button. url.mojom.Url action_url; + + // If |true|, the associated notification will be removed on button click. + bool remove_notification_on_click = true; +}; + +// Enumeration of possible notification priorities. +// NOTE: This enum maps to a subset of message_center::NotificationPriority. +enum AssistantNotificationPriority { + kLow, // See message_center::NotificationPriority::LOW_PRIORITY. + kDefault, // See message_center::NotificationPriority::DEFAULT_PRIORITY. + kHigh, // See message_center::NotificationPriority::HIGH_PRIORITY. }; // Models an Assistant notification. struct AssistantNotification { - // Type of the notification. - AssistantNotificationType type = AssistantNotificationType.kSystem; - // Title of the notification. string title; @@ -60,10 +58,23 @@ struct AssistantNotification { // Obfuscated Gaia id of the intended recipient of the user. string obfuscated_gaia_id; - // Whether this notification can turn on the display if it was off. - bool is_high_priority = false; + // Priority for the notification. This affects whether or not the notification + // will pop up and/or have the capability to wake the display if it was off. + AssistantNotificationPriority priority = kDefault; // When the notification should expire. // Expressed as milliseconds since Unix Epoch. mojo_base.mojom.Time? expiry_time; + + // If |true|, the notification will be removed on click. + bool remove_on_click = true; + + // If |true|, the user can't remove the notification. + bool is_pinned = false; + + // If |true|, this notification was sent from the server. Clicking a + // notification that was sent from the server may result in a request to the + // server to retrieve the notification payload. One example of this would be + // notifications triggered by an Assistant reminder. + bool from_server = false; }; diff --git a/chromium/chromeos/services/cros_healthd/public/mojom/cros_healthd_probe.mojom b/chromium/chromeos/services/cros_healthd/public/mojom/cros_healthd_probe.mojom index 03759429c79..ab217747726 100644 --- a/chromium/chromeos/services/cros_healthd/public/mojom/cros_healthd_probe.mojom +++ b/chromium/chromeos/services/cros_healthd/public/mojom/cros_healthd_probe.mojom @@ -15,6 +15,8 @@ module chromeos.cros_healthd.mojom; enum CpuArchitectureEnum { kUnknown, kX86_64, + kAArch64, + kArmv7l, }; // An enumeration of each category of information that cros_healthd can report. @@ -29,6 +31,7 @@ enum ProbeCategoryEnum { kBacklight, kFan, kStatefulPartition, + kBluetooth, }; // An enumeration of the different categories of errors that can occur when @@ -129,6 +132,21 @@ struct NonRemovableBlockDeviceInfo { string name; // PSN: Product serial number, 32 bits uint32 serial; + // Bytes read since last boot. + uint64 bytes_read_since_last_boot; + // Bytes written since last boot. + uint64 bytes_written_since_last_boot; + // Time spent reading since last boot. + uint64 read_time_seconds_since_last_boot; + // Time spent writing since last boot. + uint64 write_time_seconds_since_last_boot; + // Time spent doing I/O since last boot. Counts the time the disk and queue + // were busy, so unlike the fields above, parallel requests are not counted + // multiple times. + uint64 io_time_seconds_since_last_boot; + // Time spent discarding since last boot. Discarding is writing to clear + // blocks which are no longer in use. Supported on kernels 4.18+. + UInt64Value? discard_time_seconds_since_last_boot; }; // Cached VPD probe result. Can either be populated with the CachedVpdInfo or an @@ -287,6 +305,27 @@ struct StatefulPartitionInfo { uint64 total_space; }; +// Bluetooth probe result. Can either be populated with the BluetoothAdapterInfo +// or an error retrieving the information. +union BluetoothResult { + // Valid BluetoothAdapterInfo. + array<BluetoothAdapterInfo> bluetooth_adapter_info; + // The error that occurred attempting to retrieve the BluetoothAdapterInfo. + ProbeError error; +}; + +// Information related to one of a device's Bluetooth adapters. +struct BluetoothAdapterInfo { + // The name of the adapter. + string name; + // The MAC address of the adapter. + string address; + // Indicates whether the adapter is on or off. + bool powered; + // The number of devices connected to this adapter. + uint32 num_connected_devices; +}; + // A collection of all the device's telemetry information that cros_healthd is // capable of reporting. Note that every field in TelemetryInfo is nullable, and // the response for a particular ProbeTelemetryInfo request will only contain @@ -324,4 +363,7 @@ struct TelemetryInfo { // kStatefulPartition was included in the categories input to // ProbeTelemetryInfo. StatefulPartitionResult? stateful_partition_result; + // Information about the device's Bluetooth adapters and devices. Only present + // when kBluetooth was included in the categories input to ProbeTelemetryInfo. + BluetoothResult? bluetooth_result; }; diff --git a/chromium/chromeos/services/ime/public/cpp/shared_lib/BUILD.gn b/chromium/chromeos/services/ime/public/cpp/shared_lib/BUILD.gn index 84993c890a5..51ca7deb6fe 100644 --- a/chromium/chromeos/services/ime/public/cpp/shared_lib/BUILD.gn +++ b/chromium/chromeos/services/ime/public/cpp/shared_lib/BUILD.gn @@ -5,12 +5,3 @@ source_set("interfaces") { sources = [ "interfaces.h" ] } - -shared_library("fake_shared_lib") { - testonly = true - sources = [ "fake_shared_lib.cc" ] - deps = [ "//chromeos/services/ime/public/cpp/shared_lib:interfaces" ] - - # This is the name expected by DecoderEngine. - output_name = "imedecoder" -} diff --git a/chromium/chromeos/services/machine_learning/public/mojom/BUILD.gn b/chromium/chromeos/services/machine_learning/public/mojom/BUILD.gn index 183467cef9e..c0926a2d478 100644 --- a/chromium/chromeos/services/machine_learning/public/mojom/BUILD.gn +++ b/chromium/chromeos/services/machine_learning/public/mojom/BUILD.gn @@ -7,6 +7,7 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { sources = [ "graph_executor.mojom", + "handwriting_recognizer.mojom", "machine_learning_service.mojom", "model.mojom", "tensor.mojom", diff --git a/chromium/chromeos/services/machine_learning/public/mojom/handwriting_recognizer.mojom b/chromium/chromeos/services/machine_learning/public/mojom/handwriting_recognizer.mojom new file mode 100644 index 00000000000..49af2a37f62 --- /dev/null +++ b/chromium/chromeos/services/machine_learning/public/mojom/handwriting_recognizer.mojom @@ -0,0 +1,134 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Datatypes and interfaces of handwriting recognition API. + +// NOTE: This mojom exists in two places and must be kept in sync: +// Chromium: //chromeos/services/machine_learning/public/mojom/ +// Chrome OS: src/platform2/ml/mojom/ +// Note: Other repos downstream of Chromium might also use this mojom. +// Example: A backwards-compatible mojom change (and corresponding +// implementation change) can be made in Chrome OS first, then replicated to the +// clients (Chromium, other downstream repos) later. +// Use //chromeos/services/machine_learning/public/mojom/roll_mojom.sh to help +// replicate Chrome OS-side changes over to Chromium. + +module chromeos.machine_learning.mojom; + +import "mojo/public/mojom/base/time.mojom"; + +// A single point in an ink stroke. +struct InkPoint { + // (x, y) coordinates of the point. The upper-left corner of the writing area + // is (0, 0). The positive x-axis points to the right. The positive y-axis + // points down. + float x; + float y; + // Optional TimeDelta from the point was captured relative to the beginning of + // the ink. So first point of a request should have t=0. + mojo_base.mojom.TimeDelta? t; +}; + +// A single ink stroke. +struct InkStroke { + // The set of points representing the stroke. + array<InkPoint> points; +}; + +// The writing guide shown to the user during input. +struct WritingGuide { + // Size of the writing area. The writing area must have (0, 0) at the top + // left. + // width is the max value of x-axis (to the right) and height is the max + // value of y-axis (to the bottom). + float width; + float height; +}; + +// Options that will influence the recognition output. +struct RecognitionContext { + // The writing guide shown to the user when the ink was captured. + WritingGuide? writing_guide; + // The context before the written text. + string? pre_context; +}; + +// Defines a handwriting recognition query. +struct HandwritingRecognitionQuery { + // The set of ink strokes to be recognized. + array<InkStroke> ink; + // The optional context in which the ink was generated. + RecognitionContext? context; + // Maximum number of results to be returned. + uint32 max_num_results; + // If true, returns the segmentation results. This will make the response + // struct much larger. + bool return_segmentation; +}; + +// Represents a contiguous range of ink. Start and end strokes / points are +// inclusive. +struct HandwritingRecognizerInkRange { + // Zero-based start- and end-stroke indices in the ink strokes. + uint32 start_stroke; + uint32 end_stroke; + // Zero-based start- and end-point indices with the start / end strokes. + uint32 start_point; + uint32 end_point; +}; + +// A segment defines the substrokes that are associated with a substring of the +// recognized text. +struct HandwritingRecognizerSegment { + // The substring of the recognized text represented by this segment. + string sublabel; + // The ink ranges represented by this segment. + array<HandwritingRecognizerInkRange> ink_ranges; +}; + +// The ink segmentation information. +struct HandwritingRecognizerSegmentation { + // The grouping of the cut strokes into characters. + array<HandwritingRecognizerSegment> segments; +}; + +// One possible candidate from the handwriting recognition. +struct HandwritingRecognizerCandidate { + // The recognized text. + string text; + // Scores will most often correspond to -log(p(c)) or a scaling thereof, so + // lower scores represent higher confidence. + float score; + // The stroke segmentation that was used to generate the result. + HandwritingRecognizerSegmentation? segmentation; +}; + +// The handwriting recognition response. +struct HandwritingRecognizerResult { + // Status of the recognition response. + enum Status { + OK = 0, + ERROR = 1, + }; + Status status; + + // The recognition candidates with additional alternatives, sorted by lower + // score first (lower score present higher confidence). + array<HandwritingRecognizerCandidate> candidates; +}; + +// The specification of a handwriting recognizer. +struct HandwritingRecognizerSpec { + // The language the recognizer will handle. Only "en" (for english) and + // "gesture_in_context" (for gesture) are supported. + string language; +}; + +// The mojom interface for performing the recognition of handwritten text. +interface HandwritingRecognizer { + // Performs handwriting recognition on a set of ink strokes, and returns a set + // of alternative recognition results. + Recognize(HandwritingRecognitionQuery query) => + (HandwritingRecognizerResult result); +}; diff --git a/chromium/chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom b/chromium/chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom index 6819140f7a2..c22ba02f82c 100644 --- a/chromium/chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom +++ b/chromium/chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom @@ -7,14 +7,18 @@ // NOTE: This mojom exists in two places and must be kept in sync: // Chromium: //chromeos/services/machine_learning/public/mojom/ // Chrome OS: src/platform2/ml/mojom/ +// Note: Other repos downstream of Chromium might also use this mojom. // Example: A backwards-compatible mojom change (and corresponding // implementation change) can be made in Chrome OS first, then replicated to the -// client (Chromium) later. +// clients (Chromium, other downstream repos) later. +// Use //chromeos/services/machine_learning/public/mojom/roll_mojom.sh to help +// replicate Chrome OS-side changes over to Chromium. module chromeos.machine_learning.mojom; // NOTE: The base directory for 'import' statements is expected to differ // between Chromium and Chrome OS versions of this file. +import "chromeos/services/machine_learning/public/mojom/handwriting_recognizer.mojom"; import "chromeos/services/machine_learning/public/mojom/model.mojom"; import "chromeos/services/machine_learning/public/mojom/text_classifier.mojom"; @@ -24,6 +28,8 @@ enum LoadModelResult { OK = 0, MODEL_SPEC_ERROR = 1, LOAD_MODEL_ERROR = 2, + FEATURE_NOT_SUPPORTED_ERROR = 3, + LANGUAGE_NOT_SUPPORTED_ERROR = 4, }; // Top-level interface between Chromium and the ML Service daemon. @@ -40,4 +46,11 @@ interface MachineLearningService { // Create a new TextClassifier. LoadTextClassifier(pending_receiver<TextClassifier> receiver) => (LoadModelResult result); + // Create and initialize a handwriting recognizer. + LoadHandwritingModel(pending_receiver<HandwritingRecognizer> receiver) + => (LoadModelResult result); + // Create and initialize a handwriting recognizer with given |spec|. + LoadHandwritingModelWithSpec(HandwritingRecognizerSpec spec, + pending_receiver<HandwritingRecognizer> receiver) + => (LoadModelResult result); }; diff --git a/chromium/chromeos/services/network_config/public/mojom/cros_network_config.mojom b/chromium/chromeos/services/network_config/public/mojom/cros_network_config.mojom index 02d6cab680d..ba5dc03d3e6 100644 --- a/chromium/chromeos/services/network_config/public/mojom/cros_network_config.mojom +++ b/chromium/chromeos/services/network_config/public/mojom/cros_network_config.mojom @@ -547,6 +547,9 @@ struct ManagedWiFiProperties { string? tethering_state; // Indicates whether the network is eligible to be included in Chrome Sync. bool is_syncable; + // True for unshared networks and for shared networks configured by the + // active user. Updated whenever the passphrase is modified. + bool is_configured_by_active_user; }; union NetworkTypeManagedProperties { @@ -571,6 +574,7 @@ struct ManagedProperties { string guid; ManagedString? ip_address_config_type; array<IPConfigProperties>? ip_configs; + ManagedBoolean? metered; ManagedString? name; ManagedString? name_servers_config_type; ManagedInt32? priority; @@ -596,6 +600,11 @@ struct AutoConnectConfig { bool value; }; +// Wrapper to allow optional metered configuration. +struct MeteredConfig { + bool value; +}; + // Wrapper to allow optional priority configuration. struct PriorityConfig { int32 value; @@ -722,6 +731,7 @@ struct ConfigProperties { // preserve the existing guid. string? guid; string? ip_address_config_type; + MeteredConfig? metered; // Name is only required for new configurations. string? name; string? name_servers_config_type; @@ -883,6 +893,9 @@ interface CrosNetworkConfig { // Requests a scan for new networks. If the list updates, // CrosNetworkConfigObserver::OnNetworkStateListChanged() will be signaled. + // Note: If |type| is Cellular, a mobile network scan will be requested + // if supported. This is disruptive and should only be triggered by an + // explicit user action. RequestNetworkScan(NetworkType type); // Returns the global policy properties. These properties are not expected to diff --git a/chromium/chromeos/services/network_config/public/mojom/network_types.mojom b/chromium/chromeos/services/network_config/public/mojom/network_types.mojom index 6274e0ee5c6..f193fb2d011 100644 --- a/chromium/chromeos/services/network_config/public/mojom/network_types.mojom +++ b/chromium/chromeos/services/network_config/public/mojom/network_types.mojom @@ -19,6 +19,7 @@ enum ConnectionStateType { enum DeviceStateType { kUninitialized, kDisabled, + kDisabling, kEnabling, kEnabled, kProhibited, diff --git a/chromium/chromeos/services/network_health/public/mojom/BUILD.gn b/chromium/chromeos/services/network_health/public/mojom/BUILD.gn new file mode 100644 index 00000000000..0b8abc04bdc --- /dev/null +++ b/chromium/chromeos/services/network_health/public/mojom/BUILD.gn @@ -0,0 +1,17 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ + "network_diagnostics.mojom", + "network_health.mojom", + ] + + public_deps = [ + "//chromeos/services/network_config/public/mojom:network_types", + "//mojo/public/mojom/base", + ] +} diff --git a/chromium/chromeos/services/network_health/public/mojom/network_diagnostics.mojom b/chromium/chromeos/services/network_health/public/mojom/network_diagnostics.mojom new file mode 100644 index 00000000000..bbb103eb175 --- /dev/null +++ b/chromium/chromeos/services/network_health/public/mojom/network_diagnostics.mojom @@ -0,0 +1,111 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module chromeos.network_diagnostics.mojom; + +// Each routine can result in one of the possible verdicts. +[Extensible] +enum RoutineVerdict { + // Routine ran successfully and no connectivity problem found. + kNoProblem, + // Routine ran successfully and connectivity problem found. + kProblem, + // Routine has not been run. + kNotRun, +}; + +// Problems related to the SignalStrength routine. +[Extensible] +enum SignalStrengthProblem { + kSignalNotFound, + kWeakSignal, +}; + +// Problems related to the GatewayCanBePinged routine. +[Extensible] +enum GatewayCanBePingedProblem { + // All gateways are unreachable, hence cannot be pinged. + kUnreachableGateway, + // The default network cannot be pinged. + kFailedToPingDefaultNetwork, + // The default network has a latency above the threshold. + kDefaultNetworkAboveLatencyThreshold, + // One or more of the non-default networks has failed pings. + kUnsuccessfulNonDefaultNetworksPings, + // One of more of the non-default networks has a latency above the threshold. + kNonDefaultNetworksAboveLatencyThreshold, +}; + +// Messages related to the HasSecureWiFiConnection routine. +[Extensible] +enum HasSecureWiFiConnectionProblem { + kSecurityTypeNone, + kSecurityTypeWep8021x, + kSecurityTypeWepPsk, + kUnknownSecurityType, +}; + +// Messages related to the DnsResolverPresent routine. +[Extensible] +enum DnsResolverPresentProblem { + kNoNameServersFound, + kMalformedNameServers, + kEmptyNameServers, +}; + +// Messages related to the DnsLatencyProblem routine. +[Extensible] +enum DnsLatencyProblem { + // The routine was unable to successfully resolve all the hosts. Note that + // this will be true if one or more hosts could not be successfully resolved. + kFailedToResolveAllHosts, + // Average DNS latency across hosts is slightly above expected threshold + kSlightlyAboveThreshold, + // Average DNS latency across hosts is significantly above expected threshold + kSignificantlyAboveThreshold, +}; + +// Messages related to the DnsResolution routine. +[Extensible] +enum DnsResolutionProblem { + // The routine was unable to successfully resolve the test host + kFailedToResolveHost, +}; + +// This interface is to be used by any clients that need to run specific +// network-related diagnostics. Expected clients of this interface are +// NetworkHealth, cros_healthd, and a connectivity diagnostics Web UI (to name +// a few). The bound implementation is intended to live in the browser process. +interface NetworkDiagnosticsRoutines { + // Tests whether the device is connected to a LAN. It is possible that the + // device may be trapped in a captive portal yet pass this test successfully. + // Captive portal checks are done separately and are outside of the scope of + // this routine. + LanConnectivity() => (RoutineVerdict verdict); + + // Tests whether there is an acceptable signal strength on wireless networks. + SignalStrength() => (RoutineVerdict verdict, + array<SignalStrengthProblem> problems); + + // Tests whether the gateway of connected networks is pingable. + GatewayCanBePinged() => (RoutineVerdict verdict, + array<GatewayCanBePingedProblem> problems); + + // Tests whether the WiFi connection is secure. Note that if WiFi is not + // connected, the routine will result in a |kNotRun| verdict. + HasSecureWiFiConnection() => (RoutineVerdict verdict, + array<HasSecureWiFiConnectionProblem> problems); + + // Tests whether a DNS resolver is available to the browser. + DnsResolverPresent() => (RoutineVerdict verdict, + array<DnsResolverPresentProblem> problems); + + // Tests whether the DNS latency is below an acceptable threshold. + DnsLatency() => (RoutineVerdict verdict, + array<DnsLatencyProblem> problem); + + // Tests whether a DNS resolution can be completed successfully. + DnsResolution() => (RoutineVerdict verdict, + array<DnsResolutionProblem> problems); +}; diff --git a/chromium/chromeos/services/network_health/public/mojom/network_health.mojom b/chromium/chromeos/services/network_health/public/mojom/network_health.mojom new file mode 100644 index 00000000000..6c8d474e635 --- /dev/null +++ b/chromium/chromeos/services/network_health/public/mojom/network_health.mojom @@ -0,0 +1,64 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// API intended for retrieving a snapshot of the network health state. Returns +// properties of any available network technologies and any connected or +// connecting network when available. + +module chromeos.network_health.mojom; + +import "chromeos/services/network_config/public/mojom/network_types.mojom"; + +enum NetworkState { + // The network type is available but not yet initialized. + kUninitialized, + // The network type is available but disabled or disabling. + kDisabled, + // The network type is prohibited by policy. + kProhibited, + // The network type is available and enabled or enabling, but no network + // connection has been established. + kNotConnected, + // The network type is available and enabled, and a network connection is + // in progress. + kConnecting, + // The network is in a portal state. + kPortal, + // The network is in a connected state, but connectivity is limited. + kConnected, + // The network is connected and online. + kOnline, +}; + +// Contains information for a single network connection and underlying +// network technology e.g WiFi. +struct Network { + chromeos.network_config.mojom.NetworkType type; + NetworkState state; + // The unique identifier for the network when a network service exists. + string? guid; + // The user facing name of the network if available. + string? name; + // Optional string for the network's mac_address. + string? mac_address; +}; + +// Aggregate structure for all of the network health state. +struct NetworkHealthState { + // Networks will be sorted with active connections listed first. + array<Network> networks; +}; + +// Interface for retrieving aggregated information about the current network +// state and health. +interface NetworkHealthService { + // Returns a list of all the networks. Networks will be sorted with active + // connections listed first. + GetNetworkList() => (array<Network> networks); + + // Returns the current network health state. + // This is currently the same information provided by GetNetworkList. More + // information will be added over time. + GetHealthSnapshot() => (NetworkHealthState state); +}; diff --git a/chromium/chromeos/services/tts/BUILD.gn b/chromium/chromeos/services/tts/BUILD.gn new file mode 100644 index 00000000000..e2feb37c081 --- /dev/null +++ b/chromium/chromeos/services/tts/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//tools/generate_library_loader/generate_library_loader.gni") + +source_set("tts") { + sources = [ + "constants.cc", + "constants.h", + "tts_service.cc", + "tts_service.h", + ] + + deps = [ + ":libchrometts", + "//base", + "//chromeos/services/tts/public/mojom", + ] +} + +source_set("sandbox_hook") { + sources = [ + "tts_sandbox_hook.cc", + "tts_sandbox_hook.h", + ] + + deps = [ + ":libchrometts", + ":tts", + "//base", + "//sandbox/linux:sandbox_services", + "//services/service_manager/sandbox:sandbox", + ] +} + +generate_library_loader("libchrometts") { + name = "LibChromeTtsLoader" + output_h = "libchrometts.h" + output_cc = "libchrometts_loader.cc" + header = "<chrome_tts.h>" + bundled_header = "\"chromeos/services/tts/chrome_tts.h\"" + + functions = [ + "GoogleTtsSetLogger", + "GoogleTtsInit", + "GoogleTtsShutdown", + "GoogleTtsInstallVoice", + "GoogleTtsInitBuffered", + "GoogleTtsReadBuffered", + "GoogleTtsFinalizeBuffered", + "GoogleTtsGetEventBufferPtr", + "GoogleTtsGetEventBufferLen", + "GoogleTtsGetTimepointsCount", + "GoogleTtsGetTimepointsTimeInSecsAtIndex", + "GoogleTtsGetTimepointsCharIndexAtIndex", + ] +} diff --git a/chromium/chromeos/services/tts/public/mojom/BUILD.gn b/chromium/chromeos/services/tts/public/mojom/BUILD.gn new file mode 100644 index 00000000000..b677781871c --- /dev/null +++ b/chromium/chromeos/services/tts/public/mojom/BUILD.gn @@ -0,0 +1,9 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ "tts_service.mojom" ] +} diff --git a/chromium/chromeos/services/tts/public/mojom/tts_service.mojom b/chromium/chromeos/services/tts/public/mojom/tts_service.mojom new file mode 100644 index 00000000000..a8fd1cdb6cf --- /dev/null +++ b/chromium/chromeos/services/tts/public/mojom/tts_service.mojom @@ -0,0 +1,85 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module chromeos.tts.mojom; + +// Structure describing a point in time during speech synthesis. +struct Timepoint { + // The time, in seconds. + float time_sec; + + // The index in the text being spoken. + int32 char_index; +}; + +// A TTS event and associated metadata within a TTS stream. +struct TtsStreamItem { + // An internal serialized proto.speech.tts.TtsControllerEvent proto. + array<uint8> event_buffer_bytes; + + // Whether streaming is complete. + bool done; + + // A list of timepoints associated with the event above. + array<Timepoint> timepoints; +}; + +// The main interface to the TTS engine on Chrome OS. Only used by and private +// to the Chrome OS Google TTS engine component extension. TtsService lives in a +// tts-sandboxed process. TtsEngineExtensionObserver, the other end of this +// interface, in the browser process, brokers a connection between TtsService +// and the Google TTS engine component extension through a TtsStream, but does +// not participate otherwise. +interface TtsService { + // Binds a TtsStream to this service. + BindTtsStream(pending_receiver<TtsStream> receiver); +}; + +// Interface for the Google component TTS engine to control and consume a stream +// of TtsStreamItems produced by TtsService. There is only ever one TtsStream +// owned by the TtsService. +// +// The component extension sets up the stream's voice by doing: +// InstallVoice(data, "voice") +// InstallVoice(other_data, "other_voice") +// SelectVoice("other_voice") +// +// After reading from the stream (see below), the component extension can do: +// SelectVoice("voice") +// to change voices. +// +// The component extension calls the following three methods repeatedly, in +// order to read from the stream given text. For example, +// +// Init(<a proto containing text "Hello there.">) +// Read() +// Read() +// ... +// Finalize() +// Init(<proto containing text "Testing 1, 2, 3.") +// Read() +// Read() +// ... +// Finalize() +// +// Note that the component extension may call Finalize() early, if the TTS api +// wants to, for example, stop speech. +interface TtsStream { + // Forward and install the |voice_name| encoded by |voice_bytes|. + InstallVoice(string voice_name, array<uint8> voice_bytes) + => (bool success); + + // Selects a voice for streaming given a |voice_name|. + SelectVoice(string voice_name) => (bool success); + + // Initialize a new TTS stream given a serialized proto.speech.tts.Text proto. + Init(array<uint8> text_jspb) + => (bool success); + + // Read the next stream item. + Read() => (TtsStreamItem item); + + // Clean up and finish the current TTS stream. + Finalize(); +}; |