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

Unified Diff: Source/core/html/forms/FileInputType.cpp

Issue 1166473002: Add usage counters for secure and insecure use of input type file (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on ToT Created 5 years, 7 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 | « Source/core/html/forms/FileInputType.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/FileInputType.cpp
diff --git a/Source/core/html/forms/FileInputType.cpp b/Source/core/html/forms/FileInputType.cpp
index 8ee7138803e3517b5f64af23054dbf87c2e2cb16..52f83ab97882bc2d5a8cd38124a133e700651ceb 100644
--- a/Source/core/html/forms/FileInputType.cpp
+++ b/Source/core/html/forms/FileInputType.cpp
@@ -29,6 +29,7 @@
#include "core/events/Event.h"
#include "core/fileapi/File.h"
#include "core/fileapi/FileList.h"
+#include "core/frame/UseCounter.h"
#include "core/html/FormDataList.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/forms/FormController.h"
@@ -256,6 +257,19 @@ FileList* FileInputType::createFileList(const Vector<FileChooserFileInfo>& files
return fileList;
}
+void FileInputType::countUsage()
+{
+ // It is required by isPrivilegedContext() but isn't
+ // actually used. This could be used later if a warning is shown in the
+ // developer console.
+ String insecureOriginMsg;
+ Document* document = &element().document();
+ if (document->isPrivilegedContext(insecureOriginMsg))
+ UseCounter::count(*document, UseCounter::InputTypeFileInsecureOrigin);
+ else
+ UseCounter::count(*document, UseCounter::InputTypeFileSecureOrigin);
+}
+
void FileInputType::createShadowSubtree()
{
ASSERT(element().shadow());
« no previous file with comments | « Source/core/html/forms/FileInputType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698