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..f003cc815affa312ffac9871499efc0f636ce41d |
| --- /dev/null |
| +++ b/chrome/browser/safe_browsing/permission_reporter.h |
| @@ -0,0 +1,54 @@ |
| +// 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 "url/gurl.h" |
| + |
| +namespace net { |
| +class URLRequestContext; |
| +} // namespace net |
| + |
| +namespace safe_browsing { |
| + |
| +// Provides functionality for building and serializing reports about permissions |
| +// to a report collection server. |
| +class PermissionReporter { |
| + public: |
| + // Creates a permission reporter that will send permission reports to |
| + // the SafeBrowsing permission action server, using |request_context| as the |
| + // context for the reports. |
| + explicit PermissionReporter(net::URLRequestContext* request_context); |
| + |
| + ~PermissionReporter(); |
| + |
| + // Sends a permission report to the report collection server. The |
| + // |serialized_report| is expected to be a serialized protobuf of type |
| + // PermissionReport defined in |
| + // //src/chrome/common/safe_browsing/permission_report.proto |
| + void SendReport(const std::string& serialized_report); |
|
raymes
2016/06/01 06:45:45
nit: I wonder if SendReport should just call Build
kcarattini
2016/06/01 12:25:49
Yup, that could work. BuildReport should remain a
stefanocs
2016/06/02 00:24:32
Then SendReport signature should be modified to ha
stefanocs
2016/06/02 04:31:04
Done.
|
| + |
| + // Builds and serializes 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. The serialized report is |
| + // written into |output|. Returns true if the serialization was successful and |
| + // false otherwise. |
| + static bool BuildReport(const GURL& origin, |
| + content::PermissionType permission, |
|
raymes
2016/06/01 06:45:44
nit: #include permission_type.h
stefanocs
2016/06/01 07:25:02
Done.
|
| + PermissionAction action, |
| + std::string* output); |
| + |
| + private: |
| + const GURL upload_url_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PermissionReporter); |
| +}; |
| + |
| +} // namespace safe_browsing |
| + |
| +#endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |