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

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: 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 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 4539 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 return KURL(); 4550 return KURL();
4551 4551
4552 if (!head()) 4552 if (!head())
4553 return KURL(); 4553 return KURL();
4554 4554
4555 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head()); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*lin kElement)) { 4555 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head()); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*lin kElement)) {
4556 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation)) 4556 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation))
4557 continue; 4557 continue;
4558 if (linkElement->href().isEmpty()) 4558 if (linkElement->href().isEmpty())
4559 continue; 4559 continue;
4560
4561 // Count usage; perhaps we can lock this to secure contexts.
4562 UseCounter::Feature osdDisposition;
4563 RefPtr<SecurityOrigin> target = SecurityOrigin::create(linkElement->href ());
4564 if (isSecureContext()) {
4565 osdDisposition = target->isPotentiallyTrustworthy()
4566 ? UseCounter::OpenSearchSecureOriginSecureTarget
4567 : UseCounter::OpenSearchSecureOriginInsecureTarget;
4568 } else {
4569 osdDisposition = target->isPotentiallyTrustworthy()
4570 ? UseCounter::OpenSearchInsecureOriginSecureTarget
4571 : UseCounter::OpenSearchInsecureOriginInsecureTarget;
4572 }
4573 UseCounter::count(*this, osdDisposition);
4574
4560 return linkElement->href(); 4575 return linkElement->href();
4561 } 4576 }
4562 4577
4563 return KURL(); 4578 return KURL();
4564 } 4579 }
4565 4580
4566 void Document::currentScriptForBinding(HTMLScriptElementOrSVGScriptElement& scri ptElement) const 4581 void Document::currentScriptForBinding(HTMLScriptElementOrSVGScriptElement& scri ptElement) const
4567 { 4582 {
4568 if (Element* script = currentScript()) { 4583 if (Element* script = currentScript()) {
4569 if (script->isInV1ShadowTree()) 4584 if (script->isInV1ShadowTree())
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
6008 } 6023 }
6009 6024
6010 void showLiveDocumentInstances() 6025 void showLiveDocumentInstances()
6011 { 6026 {
6012 WeakDocumentSet& set = liveDocumentSet(); 6027 WeakDocumentSet& set = liveDocumentSet();
6013 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6028 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6014 for (Document* document : set) 6029 for (Document* document : set)
6015 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6030 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6016 } 6031 }
6017 #endif 6032 #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