| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/data_use_measurement/content/data_use_measurement_util.h" |
| 6 |
| 7 #include "content/public/browser/resource_request_info.h" |
| 8 #include "net/url_request/url_request.h" |
| 9 |
| 10 namespace data_use_measurement { |
| 11 |
| 12 DataUseMeasurement::IsUserInitiatedRequestCallbackType |
| 13 GetIsUserInitiatedRequestCallback() { |
| 14 return base::Bind(&IsUserInitiatedRequest); |
| 15 } |
| 16 |
| 17 bool IsUserInitiatedRequest(const net::URLRequest& request) { |
| 18 // Having ResourceRequestInfo in the URL request is a sign that the request is |
| 19 // for a web content from user. For now we could add a condition to check |
| 20 // ProcessType in info is content::PROCESS_TYPE_RENDERER, but it won't be |
| 21 // compatible with upcoming PlzNavigate architecture. So just existence of |
| 22 // ResourceRequestInfo is verified, and the current check should be compatible |
| 23 // with upcoming changes in PlzNavigate. |
| 24 // TODO(rajendrant): Verify this condition for different use cases. See |
| 25 // crbug.com/626063. |
| 26 return content::ResourceRequestInfo::ForRequest(&request) != nullptr; |
| 27 } |
| 28 |
| 29 } // namespace data_use_measurement |
| OLD | NEW |