diff options
Diffstat (limited to 'chromium/chromeos/components')
32 files changed, 1559 insertions, 107 deletions
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" ] +} |