Index: components/data_use_measurement/content/data_use_measurement_delegate_imp.cc |
diff --git a/components/data_use_measurement/content/data_use_measurement_delegate_imp.cc b/components/data_use_measurement/content/data_use_measurement_delegate_imp.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ce999eb558e607de4167569478ef49ce7b862183 |
--- /dev/null |
+++ b/components/data_use_measurement/content/data_use_measurement_delegate_imp.cc |
@@ -0,0 +1,23 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/data_use_measurement/content/data_use_measurement_delegate_imp.h" |
+ |
+#include "content/public/browser/resource_request_info.h" |
+ |
+namespace data_use_measurement { |
+ |
+bool DataUseMeasurementDelegateImp::RequestIsFromUser( |
+ const net::URLRequest* request) { |
+ const content::ResourceRequestInfo* info = |
+ content::ResourceRequestInfo::ForRequest(request); |
+ // Having |info| is the sign of a request for a web content from user. For now |
+ // we could add a condition to check ProcessType in info is |
+ // content::PROCESS_TYPE_RENDERER, but it won't be compatible with upcoming |
+ // PlzNavigate architecture. So just existence of |info| is verified, and the |
+ // current check should be compatible with upcoming changes in PlzNavigate. |
+ return info != nullptr; |
+} |
+ |
+} // namespace data_use_measurement |