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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 4537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4548 return KURL(); 4548 return KURL();
4549 4549
4550 if (!head()) 4550 if (!head())
4551 return KURL(); 4551 return KURL();
4552 4552
4553 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head()); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*lin kElement)) { 4553 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head()); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*lin kElement)) {
4554 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation)) 4554 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation))
4555 continue; 4555 continue;
4556 if (linkElement->href().isEmpty()) 4556 if (linkElement->href().isEmpty())
4557 continue; 4557 continue;
4558
4559 // Count usage; perhaps we can lock this to secure contexts.
4560 UseCounter::Feature osdDisposition;
4561 RefPtr<SecurityOrigin> target = SecurityOrigin::create(linkElement->href ());
4562 if (isSecureContext()) {
lgarron 2016/06/10 20:00:46 Hmm, so there are 2 URLs and 2 URL patterns in pla
4563 osdDisposition = target->isPotentiallyTrustworthy()
4564 ? UseCounter::OpenSearchSecureOriginSecureTarget
4565 : UseCounter::OpenSearchSecureOriginInsecureTarget;
4566 } else {
4567 osdDisposition = target->isPotentiallyTrustworthy()
4568 ? UseCounter::OpenSearchInsecureOriginSecureTarget
4569 : UseCounter::OpenSearchInsecureOriginInsecureTarget;
4570 }
4571 UseCounter::count(*this, osdDisposition);
4572
4558 return linkElement->href(); 4573 return linkElement->href();
4559 } 4574 }
4560 4575
4561 return KURL(); 4576 return KURL();
4562 } 4577 }
4563 4578
4564 void Document::currentScriptForBinding(HTMLScriptElementOrSVGScriptElement& scri ptElement) const 4579 void Document::currentScriptForBinding(HTMLScriptElementOrSVGScriptElement& scri ptElement) const
4565 { 4580 {
4566 if (Element* script = currentScript()) { 4581 if (Element* script = currentScript()) {
4567 if (script->isInV1ShadowTree()) 4582 if (script->isInV1ShadowTree())
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
6006 } 6021 }
6007 6022
6008 void showLiveDocumentInstances() 6023 void showLiveDocumentInstances()
6009 { 6024 {
6010 WeakDocumentSet& set = liveDocumentSet(); 6025 WeakDocumentSet& set = liveDocumentSet();
6011 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6026 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6012 for (Document* document : set) 6027 for (Document* document : set)
6013 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6028 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6014 } 6029 }
6015 #endif 6030 #endif
OLDNEW
« 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