Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp

Issue 2663193004: Add rappor metrics to track Web Bluetooth API usage (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
index 3f2e4facc29754a195ede0d69eb678b008c37e46..fb7cb82033326c960cad65268deda2b6ac2498a6 100644
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
@@ -19,6 +19,7 @@
#include "modules/bluetooth/RequestDeviceOptions.h"
#include "platform/UserGestureIndicator.h"
#include "public/platform/InterfaceProvider.h"
+#include "public/platform/Platform.h"
#include <memory>
#include <utility>
@@ -179,9 +180,8 @@ ScriptPromise Bluetooth::requestDevice(ScriptState* scriptState,
if (!m_service) {
InterfaceProvider* interfaceProvider = nullptr;
- ExecutionContext* executionContext = scriptState->getExecutionContext();
- if (executionContext->isDocument()) {
- Document* document = toDocument(executionContext);
+ if (context->isDocument()) {
+ Document* document = toDocument(context);
if (document->frame())
interfaceProvider = document->frame()->interfaceProvider();
}
@@ -212,6 +212,11 @@ ScriptPromise Bluetooth::requestDevice(ScriptState* scriptState,
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
+ // Record the eTLD+1 of the frame using the API.
+ Document* document = toDocument(context);
+ Platform::current()->recordRapporURL("Bluetooth.APIUsage.Origin",
+ document->url());
+
// Subsequent steps are handled in the browser process.
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698