Chromium Code Reviews| Index: chrome/browser/safe_browsing/permission_reporter.h |
| diff --git a/chrome/browser/safe_browsing/permission_reporter.h b/chrome/browser/safe_browsing/permission_reporter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f59b4c16338a6e9b142ed089aa2a668212dee6b9 |
| --- /dev/null |
| +++ b/chrome/browser/safe_browsing/permission_reporter.h |
| @@ -0,0 +1,58 @@ |
| +// 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. |
| + |
| +#ifndef CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
| +#define CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
| + |
| +#include <string> |
| + |
| +#include "chrome/browser/permissions/permission_uma_util.h" |
| +#include "chrome/common/safe_browsing/permission_report.pb.h" |
| +#include "net/url_request/certificate_report_sender.h" |
| +#include "url/gurl.h" |
| + |
| +namespace net { |
| +class URLRequestContext; |
| +} // namespace net |
| + |
| +namespace safe_browsing { |
| + |
| +// Provides functionality for building and serializing reports about permission |
|
kcarattini
2016/05/31 03:13:38
s/permission/permissions/
stefanocs
2016/05/31 03:34:22
Done.
|
| +// to a report collection server. |
| +class PermissionReporter { |
| + public: |
| + // Creates a permission reporter that will send permission reports to |
| + // |upload_url|, using |request_context| as the context for the reports. |
| + PermissionReporter( |
| + net::URLRequestContext* request_context, |
|
kcarattini
2016/05/31 03:13:38
You can move this up to the previous line.
stefanocs
2016/05/31 03:34:23
Done.
|
| + const GURL& upload_url); |
| + |
| + virtual ~PermissionReporter(); |
| + |
| + // Sends a permission report to the report collection server. The |
| + // |serialized_report| is expected to be a serialized protobuf implemented in |
|
kcarattini
2016/05/31 03:13:38
"A serialized protobuf of type PermissionReport de
stefanocs
2016/05/31 03:34:22
Done.
|
| + // //src/chrome/common/safe_browsing/permission_report.proto |
| + virtual void SendReport(const std::string& serialized_report); |
| + |
| + // Builds a permission report with |origin| as the origin of the site |
| + // requesting permission, |permission| as the type of permission requested, |
| + // and |action| as the action taken. |
| + static PermissionReport BuildReport( |
|
kcarattini
2016/05/31 03:13:38
This is fine for now, though if the list of argume
stefanocs
2016/05/31 03:34:22
Can the other required information obtained within
kcarattini
2016/05/31 03:53:36
I'm not certain yet but some of it definitely will
stefanocs
2016/05/31 04:04:12
Acknowledged.
|
| + const GURL& origin, |
|
kcarattini
2016/05/31 03:13:38
Can move this up a line too.
stefanocs
2016/05/31 03:34:23
Done.
|
| + content::PermissionType permission, |
| + PermissionAction action); |
| + |
| + private: |
| + // TODO(stefanocs): Refactor permission report sender to use the more generic |
| + // report sender class when it has been implemented. |
|
kcarattini
2016/05/31 03:13:38
Isn't it CertificateReportSender that you want to
stefanocs
2016/05/31 03:34:23
What I meant is that since we are probably going t
kcarattini
2016/05/31 03:53:36
Ah, I see. i don't think you need a todo for that
stefanocs
2016/05/31 04:04:12
Done.
|
| + std::unique_ptr<net::CertificateReportSender> permission_report_sender_; |
| + |
| + const GURL upload_url_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PermissionReporter); |
| +}; |
| + |
| +} // namespace safe_browsing |
| + |
| +#endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |