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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2053343002: Add use counters for secure/insecure OpenSearch links and registerProtocolHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index ab4b0767245b116e8ab8fa5ab4bae921665ad2af..a81627356055fe4b4e21c5b7c683e63ded3891d5 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4557,6 +4557,21 @@ KURL Document::openSearchDescriptionURL()
continue;
if (linkElement->href().isEmpty())
continue;
+
+ // Count usage; perhaps we can lock this to secure contexts.
+ UseCounter::Feature osdDisposition;
+ RefPtr<SecurityOrigin> target = SecurityOrigin::create(linkElement->href());
+ if (isSecureContext()) {
+ osdDisposition = target->isPotentiallyTrustworthy()
+ ? UseCounter::OpenSearchSecureOriginSecureTarget
+ : UseCounter::OpenSearchSecureOriginInsecureTarget;
+ } else {
+ osdDisposition = target->isPotentiallyTrustworthy()
+ ? UseCounter::OpenSearchInsecureOriginSecureTarget
+ : UseCounter::OpenSearchInsecureOriginInsecureTarget;
+ }
+ UseCounter::count(*this, osdDisposition);
+
return linkElement->href();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698