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

Unified Diff: components/data_use_measurement/content/data_use_measurement_delegate_imp.cc

Issue 1355893004: Complete the layered architecture of data_use_measurement component. Base URL: https://chromium.googlesource.com/chromium/src.git@NewArchServices
Patch Set: Created 5 years, 3 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
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

Powered by Google App Engine
This is Rietveld 408576698