Commit e543f5fc authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

fixup! OnionSoup: Remove all uses of UseCounter::Count(const LocalFrame*) in blink/renderer/modules

Apply new review comments to the original CL more. This CL makes to use alternative ones
instead of LocalFrame in the first argument of UseCounter::Count.

Bug: 936187
Change-Id: I432a68708af7280c997fb5e2d61a7774eb8d2a99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1498735
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638010}
parent 4718926b
......@@ -46,7 +46,7 @@ void DeviceMotionController::DidAddEventListener(
LocalFrame* frame = GetDocument().GetFrame();
if (frame) {
if (GetDocument().IsSecureContext()) {
UseCounter::Count(frame, WebFeature::kDeviceMotionSecureOrigin);
UseCounter::Count(GetDocument(), WebFeature::kDeviceMotionSecureOrigin);
} else {
Deprecation::CountDeprecation(frame,
WebFeature::kDeviceMotionInsecureOrigin);
......
......@@ -42,7 +42,7 @@ void DeviceOrientationAbsoluteController::DidAddEventListener(
LocalFrame* frame = GetDocument().GetFrame();
if (frame) {
if (GetDocument().IsSecureContext()) {
UseCounter::Count(frame->GetDocument(),
UseCounter::Count(GetDocument(),
WebFeature::kDeviceOrientationAbsoluteSecureOrigin);
} else {
Deprecation::CountDeprecation(
......
......@@ -57,7 +57,7 @@ void DeviceOrientationController::DidAddEventListener(
LocalFrame* frame = GetDocument().GetFrame();
if (frame) {
if (GetDocument().IsSecureContext()) {
UseCounter::Count(frame->GetDocument(),
UseCounter::Count(GetDocument(),
WebFeature::kDeviceOrientationSecureOrigin);
} else {
Deprecation::CountDeprecation(
......
......@@ -502,8 +502,7 @@ bool UserMediaRequest::IsSecureContextUse(String& error_message) {
Document* document = OwnerDocument();
if (document->IsSecureContext(error_message)) {
UseCounter::Count(document->GetFrame(),
WebFeature::kGetUserMediaSecureOrigin);
UseCounter::Count(document, WebFeature::kGetUserMediaSecureOrigin);
UseCounter::CountCrossOriginIframe(
*document, WebFeature::kGetUserMediaSecureOriginIframe);
......
......@@ -70,7 +70,7 @@ bool NavigatorVibration::vibrate(Navigator& navigator,
// reference to |window| or |navigator| was retained in another window.
if (!frame)
return false;
CollectHistogramMetrics(*frame);
CollectHistogramMetrics(navigator);
DCHECK(frame->GetDocument());
DCHECK(frame->GetPage());
......@@ -101,14 +101,16 @@ bool NavigatorVibration::vibrate(Navigator& navigator,
}
// static
void NavigatorVibration::CollectHistogramMetrics(const LocalFrame& frame) {
void NavigatorVibration::CollectHistogramMetrics(const Navigator& navigator) {
NavigatorVibrationType type;
bool user_gesture = frame.HasBeenActivated();
UseCounter::Count(frame.GetDocument(), WebFeature::kNavigatorVibrate);
if (!frame.IsMainFrame()) {
UseCounter::Count(frame.GetDocument(),
LocalFrame* frame = navigator.GetFrame();
bool user_gesture = frame->HasBeenActivated();
UseCounter::Count(navigator.DomWindow()->document(),
WebFeature::kNavigatorVibrate);
if (!frame->IsMainFrame()) {
UseCounter::Count(navigator.DomWindow()->document(),
WebFeature::kNavigatorVibrateSubFrame);
if (frame.IsCrossOriginSubframe()) {
if (frame->IsCrossOriginSubframe()) {
if (user_gesture)
type = NavigatorVibrationType::kCrossOriginSubFrameWithUserGesture;
else
......
......@@ -72,7 +72,7 @@ class MODULES_EXPORT NavigatorVibration final
// Inherited from ContextLifecycleObserver.
void ContextDestroyed(ExecutionContext*) override;
static void CollectHistogramMetrics(const LocalFrame&);
static void CollectHistogramMetrics(const Navigator&);
Member<VibrationController> controller_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment