These sensor types are not implemented on any platform. This change
removes them from the Mojo interface to avoid needing to handle the case
of an unsupported sensor type in the browser process.
Some unit tests needed to be rewritten because they were using these
types since they don't limit update frequency or precision.
Change-Id: I7bdd52f1966a7b002f8a28695ec4120118d1c82e
Fixed: 364119459
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5852174
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/main@{#1356111}
NOTREACHED() has turned [[noreturn]] so the former macro isn't needed
anymore.
This does not attempt to do a rewrite of any surrounding code, like:
if (!foo) {
NOTREACHED();
}
to CHECK(foo);
Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.
NO_IFTTT=No-op-rename migration.
Bug: 40580068
Change-Id: I068c5fdce9dc4c352d8bdd62bb3cd2c0a2d59659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5782602
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1342096}
ContentBrowserTest::SetUpCommandLine() is actually not defined. Calls to
this method ends up running BrowserTestBase::SetUpCommandLine(), which
is always going to be empty. Since there is no point in calling this
method, delete all the callers from SetUpCommandLine() overrides. When
the override becomes empty, delete the override altogether.
Make a note of this in the comments in content_browser_test.h. Also fix
some lint errors along the way.
Change-Id: I81f263286d72ebdab68dfd9575ad4cf2b6378a3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5691227
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1325736}
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:
- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)
Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.
#crbug-todo-migration
Bug: b/321899722
Change-Id: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290838}
//content/browser/generic_sensor/README.md:
- Document the DevTools integration and how the CDP commands are
implemented by EmulationHandler and the classes in this directory.
- Document the content_shell implementation of the virtual sensor
commands.
//services/device/generic_sensor:
- Document //content classes and describe how VirtualPlatformSensor and
VirtualPlatformSensorProvider work and integrated into the rest of the
architecture.
Bug: 1278377
Change-Id: I7494523f8548e19944a982a4ade2a13deeb9b7e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4770868
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Auto-Submit: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/main@{#1217843}
Design doc:
https://docs.google.com/document/d/1JS2Wnyc9GiS_u1Ry3w4KsCyd51g8fm4RDEUcanZgzbM/edit?usp=sharing
This adds a few types and 3 new commands to the Emulation domain:
* getOverriddenSensorInformation(type: SensorType) -> { requestedSamplingFrequency: number }
* setSensorOverrideEnabled(enabled: boolean, type: SensorType, optional metadata: SensorMetadata)
* setSensorOverrideReadings(type: SensorType, reading: SensorReading)
Together, they allow us to implement the create/get/update/remove
virtual sensor WebDriver commands from the Automation section of the
Generic Sensor spec (the ChromeDriver bits will come later).
Most of the code has already been implemented elsewhere in content and
services. The CDP bits involve exposing the virtual sensor operations
from WebContentsSensorProviderProxy via an RAII object called
ScopedVirtualSensorForDevTools: since the entry point to the virtual
sensor operations is always CDP, this object is responsible for
automatically creating and removing virtual sensors while WCSPP takes
care of creating only one ScopedVirtualSensorForDevTools per sensor
type. This way, each EmulationHandler instance has its own set of
virtual sensors that are cleared when it is disabled, and other handlers
that exist at the same time are unable to create, interact with or
remove these virtual sensors.
[The increase in binary size for Fuchsia cannot be avoided, it all comes
mostly from the generated code for the new data in browser_protocol.pdl and
the new code in content::protocol::EmulationHandler]
Bug: 1278377
Fuchsia-Binary-Size: Size increase is unavoidable.
Change-Id: Ie891bea3f46ff90192ed860f8ffe5361c8485df7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4770864
Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Auto-Submit: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1211361}
Design doc:
https://docs.google.com/document/d/1JS2Wnyc9GiS_u1Ry3w4KsCyd51g8fm4RDEUcanZgzbM/edit?usp=sharing
This implements the concept of "virtual sensors" from the Automation
section of the Generic Sensor spec. From a spec perspective, virtual
sensors act like device sensors whose readings and properties are
controlled by users.
In Chromium, virtual sensors are represented by the
VirtualPlatformSensor class. There is a specific provider for them,
VirtualPlatformSensorProvider.
There is one VirtualPlatformSensorProvider instance per Mojo connection
that calls CreateVirtualSensor(), so that virtual sensors created in one
tab (not frame, and they persist across navigations) do not interfere
with other tabs (virtual sensors of the same type may be used with
completely different properties, constraints, and readings in different
pages and they should not affect each other).
On the //service side, SensorProviderImpl's `provider_` remains the same
and manages real sensors. The new `virtual_providers_` member maps a
mojo::ReceiverId to a VirtualPlatformSensorProvider.
On the //content side, WebContentsSensorProviderProxy is responsible for
invoking the Mojo operations on SensorProviderImpl. As before, it is not
accessible to Blink.
One consequence of this design is that fusion sensors will continue to
attempt to use only real sensors as sources, unless the fusion sensor
itself is created as a virtual sensor. Another consequence of this
design is that it is possible for real and virtual sensors of the same
type to coexist in the same page: real sensors are used as long as
CreateVirtualSensor() is not called; once that happens new sensors will
be virtual, but existing ones will not be affected.
Finally, the new code is tested by making GenericSensorServiceTest use
virtual sensors. GenericSensorServiceTest already tested the behavior of
the SensorImpl and SensorProviderImpl layer, so it is the ideal place to
start testing how SensorProviderImpl handles virtual sensors. It also
allows us to test a lot of VirtualPlatformSensorProvider directly.
This also helps with bug 1427302 now that usage of
FakePlatformSensor{Provider} usage has reduced considerably.
Bug: 1278377, 1427302
Change-Id: Iebe3e70bfe1d154e305243f876d9ae8b436757c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4770863
Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1208711}
This is being done in preparation for adding the concept of "virtual
sensors" that implement the Automation section of the Generic Sensor
spec.
Virtual sensors manipulation is a privileged operation that should not
be exposed to Blink, so we now add a blink.mojom.WebSensorProvider
interface that it is supposed to use instead of
device.mojom.SensorProvider. FrameSensorProviderProxy in //content is
responsible for receiving WebSensorProvider requests and translating
them into SensorProvider ones that reach //services via
WebContentsSensorProviderProxy.
At the moment, both Mojo interfaces expose the same GetSensor() method,
but the idea is for SensorProvider to have extra virtual sensor methods
that WebSensorProvider will not.
Bug: 1278377
Change-Id: I96ea78f66cd6219cb46a49b90791dd17fde2d085
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4916233
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1206683}
This is done in preparation for the upcoming virtual sensor patches that
implement the Automation section of the Generic Sensor spec, as a
virtual sensor created in an iframe should be visible and used by other
frames in the same page. Virtual sensor settings should also persist
across navigations in the same tab (so that WebDriver users can do the
setup before loading the page under test, for example).
SensorProviderProxyImpl has been split into two classes:
- WebContentsSensorProviderProxy is a per-WebContents object (i.e. there
is only one regardless of the number of frames in the same tab, and it
persists across navigations in the same tab). It contains the
mojo::Remote that communicates with //services and calls GetSensor()
in SensorProviderImpl.
- FrameSensorProviderProxy is a per-RenderFrameHost object that contains
the mojo::ReceiverSet that Blink reaches when calling GetSensor(). It
performs all permission checks and then reaches into
WebContentsSensorProviderProxy to forward the call to //services.
This means that all calls to e.g. GetSensor() from Blink coming from the
same page (regardless of the frame) are routed to //services via the
same object (and therefore same mojo::ReceiverId from a //services
perspective), which also results in fewer Mojo connections between
content and services. The existing permission and permission policy
checks remain though, so this change has no user-visible effects.
WebContentsSensorProviderProxy still needs to be aware of
FrameSensorProviderProxy because it needs to notify one or more
instances that its mojo::ReceiverSet needs to be cleared due to a Mojo
connection error on the //services side.
Bug: 1278377
Change-Id: I2d38f406c52b7d3f73b9d6f0db60638367fefb79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4770862
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1206601}
PermissionManager contains duplicated methods that differentiate by permissions type enum (ContentSettingsType vs PermissionType). This CL removed most of the ContentSettingsType-related methods, because they had limited usage, mostly in tests.
Methods removed from PermissionManager:
* RequestPermission(ContentSettingsType)
* RequestPermissions(ContentSettingsType)
* RequestPermissionFromCurrentDocument
(ContentSettingsType)
* PermissionManager::RequestPermissionsFromCurrentDocument
(ContentSettingsType)
* GetPermissionStatusForFrame(ContentSettingsType)
* GetPermissionStatusForWorker(ContentSettingsType)
* GetPermissionStatusForFrame(PermissionType)
Methods removed from PermissionControllerDelegate:
* GetPermissionStatusForFrame(PermissionType)
Methods added to PermissionControllerDelegate:
* RequestPermissionsFromCurrentDocument(PermissionType)
Methods added to PermissionManager:
* RequestPermissionsFromCurrentDocument(PermissionType)
Bug: 1271543
Change-Id: I7c718e3a1a390cd5be6f143ad8f7a07477473e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3599030
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Illia Klimov <elklm@google.com>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Quick-Run: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1002151}
This CL renames BackForwardCacheDisabling Feature related functions on
the browser side so that the names are clear. Now sticky blocking
features need to call OnBackForwardCacheDisablingStickyFeature().
Bug: 1257067,1254588
Change-Id: Ibd240491eaa29182cb8f944dc3583431861a1c57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3225745
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933334}
This patch renames `GURL::GetOrigin()` to
`GURL::DeprecatedGetOriginAsURL()`. A subsequent patch will
reintroduce a `GURL::GetOrigin()` that returns a `url::Origin`
rather than a `GURL`.
This patch was brought to you by sed, followed by a little manual
work to deal with look-alike methods (most notably
`CascadePriority::GetOrigin()` and `NudgeTracker::GetOrigin()`) and
two or three spots that held pointers to GURLs:
```
git grep -n -l ".GetOrigin(" | \
xargs -L1 sed -i '' \
-e 's/\.GetOrigin(/.DeprecatedGetOriginAsURL(/g'
```
Bug: 512374
Change-Id: I03fb290650b8759d9849af0911cad9bdc92a5132
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3220292
Commit-Queue: Mike West <mkwst@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#931431}
Use the new "mixins" feature in dirmd.
Derive mixins from file:// links in OWNERS files.
This CL is machine-generated, in two parts.
Part 1: use mixins.
1. Save current metadata to JSON files, in ORIGINAL and REDUCED forms.
dirmd read -form original > ~/tmp/dirmd/original.json
dirmd read -form reduced > ~/tmp/dirmd/reduced.json
2. Run mixins.py.
Source code: https://gist.github.com/nodirg/b59d3df338a72a8944f957c5b3a15e22
The script finds related directories, connected by file:// links
in OWNERS files. For those directories that have the same base
name, e.g.
components/autofill
chrome/android/java/src/org/chromium/chrome/browser/autofill
if importing the "parent" to the "child" reduces metadata, or adds
missing metadata, extract the common metadata to COMMON_METADATA
and import it in both directories.
Part2: deduplicate metadata.
Apply same instructions as in
https://chromium-review.googlesource.com/c/chromium/src/+/2795985/16
Bug: 1179786
Change-Id: I2e6378004ce433e02f1c9360b09eb72354083bf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897943
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Fred Mello <fredmello@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Cr-Commit-Position: refs/heads/main@{#925648}
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).
This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
'--ignore-certificate-errors' is bad, because its behavior is not
plumbed correctly everywhere. As a result, its behavior is different
from using a real SSL certificate.
For tests that need to use multiple distinct sites (and not
just different origins), using either MockCertVerifier or
the net::EmbeddedTestServer::CERT_TEST_NAMES can allow multiple
distinct sites to talk to the test server.
Currently folks, are copy-pasting existing tests with
"ignore-certificate-errors". It would be lovely to update existing test
so that folks can start copy-pasting the "good" way instead.
This patch updates:
generic_sensor_browsertest.cc
Bug: 1236525, 1124775
Change-Id: I2a159474808b523c1a6796383b20d9bc703e84f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3074599
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Ryan Sleevi <rsleevi@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#909285}
This CL does a global replace on
mojom::FeaturePolicyFeature => mojom::PermissionsPolicyFeature
blink::FeaturePolicyFeatureState => blink::PermissionsPolicyFeatureState
Note: histogram enum FeaturePolicyFeature is untouched.
Bug: 1123116
Change-Id: Ib3373f24363558ae07d240663815a421f143bd85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2705646
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Charlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#859858}
This CL renames 'feature_policy' in file names to 'permissions_policy'
with 2 exceptions:
- dom_feature_policy
- feature_policy_violation_report_body
Both files are closely related to V8 bindings. Changing the file name
would require change to class name defined in the file.
Bug: 1123116
Change-Id: I17968f745fa983df30dcf94fe37c6b4b91616f1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2704785
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Charlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#859569}
This CL implements blink bindings for Gravity sensor [1] and
adds Android, Win, Linux, CrOs platform support to get Gravity values.
Gravity Sensor can either be a physical sensor, in some phones for
example. In this case, the value is read directly from the sensor.
Otherwise if gravity sensor is not found, gravity value can be extracted
from the accelerometer.
The gravity fusion sensor implementation is similar to the linear
acceleration fusion sensor, since gravity extraction is a step in the
linear acceleration calculation.
[1] ED specification for Gravity Sensor:
https://w3c.github.io/accelerometer/#gravitysensorhttps://chromestatus.com/feature/5384099747332096
Bug: 1163993
Change-Id: I756f2450176c2e3d96a9934bdadac133d57186e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636160
Reviewed-by: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Arnaud Mandy <arnaud.mandy@intel.com>
Cr-Commit-Position: refs/heads/master@{#849487}
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.
Completely mechanical and already R+ed as part of r765923.
Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
Include this directly in relevant test files. This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.
Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
This change applies the BindOnceRewriter in //content.
This rewriter replaces calls to base::Bind and base::BindRepeating with
calls to base::BindOnce, in case the result is immediately assigned to a
base::OnceCallback. Given that base::RepeatingCallback is implicitly
convertible to base::OnceCallback, there is no change in functionality.
Steps:
1. run_tool.py --tool base_bind_rewriters \
--tool-arg='--rewriter=bind_to_bind_once'
2. git cl format
This CL was uploaded by git cl split.
R=boliu@chromium.org, raymes@chromium.org, tguilbert@chromium.org
Bug: 714018
Change-Id: Icff62462cb0aa894ab23cce94862928d429ed572
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132410
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760417}