Chromium Code Reviews| Index: components/data_use_measurement/content/content_url_request_classifier.cc |
| diff --git a/components/data_use_measurement/content/content_url_request_classifier.cc b/components/data_use_measurement/content/content_url_request_classifier.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..845866c3343124ce6ed238ccfc64faa13ba42eb0 |
| --- /dev/null |
| +++ b/components/data_use_measurement/content/content_url_request_classifier.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2016 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/content_url_request_classifier.h" |
| + |
| +#include "content/public/browser/resource_request_info.h" |
| +#include "net/url_request/url_request.h" |
| + |
| +namespace data_use_measurement { |
| + |
| +bool IsUserRequest(const net::URLRequest& request) { |
| + // The presence of ResourecRequestInfo in |request| implies that this request |
| + // was |
|
Not at Google. Contact bengr
2016/11/11 00:09:49
Fix formatting
Raj
2016/11/11 19:10:39
Done.
|
| + // created for a content::WebContents. 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 |
| + // ResourceRequestInfo is verified, and the current check should be compatible |
| + // with upcoming changes in PlzNavigate. |
| + // TODO(rajendrant): Verify this condition for different use cases. See |
| + // crbug.com/626063. |
| + return content::ResourceRequestInfo::ForRequest(&request) != nullptr; |
| +} |
| + |
| +bool ContentURLRequestClassifier::IsUserRequest( |
| + const net::URLRequest& request) const { |
| + return IsUserRequest(request); |
| +} |
| + |
| +} // namespace data_use_measurement |