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

Side by Side Diff: chrome/browser/safe_browsing/protocol_manager_helper.h

Issue 2650973005: Componentize ping_manager (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_
7
8 // A class that provides common functionality for safebrowsing protocol managers
9 // that communicate with Google servers.
10
11 #include <memory>
12 #include <string>
13
14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h"
16 #include "components/safe_browsing_db/safe_browsing_prefs.h"
17
18 namespace safe_browsing {
19
20 struct SafeBrowsingProtocolConfig {
21 SafeBrowsingProtocolConfig();
22 SafeBrowsingProtocolConfig(const SafeBrowsingProtocolConfig& other);
23 ~SafeBrowsingProtocolConfig();
24 std::string client_name;
25 std::string url_prefix;
26 std::string backup_connect_error_url_prefix;
27 std::string backup_http_error_url_prefix;
28 std::string backup_network_error_url_prefix;
29 std::string version;
30 bool disable_auto_update;
31 };
32
33 class SafeBrowsingProtocolManagerHelper {
34 public:
35 // returns version
36 static std::string Version();
37
38 // Composes a URL using |prefix|, |method| (e.g.: gethash, download, report).
39 // |client_name| and |version|. When not empty, |additional_query| is
40 // appended to the URL with an additional "&" in the front.
41 static std::string ComposeUrl(const std::string& prefix,
42 const std::string& method,
43 const std::string& client_name,
44 const std::string& version,
45 const std::string& additional_query);
46
47 // Similar to above function, and appends "&ext=1" at the end of URL if
48 // |is_extended_reporting| is true, otherwise, appends "&ext=0".
49 static std::string ComposeUrl(const std::string& prefix,
50 const std::string& method,
51 const std::string& client_name,
52 const std::string& version,
53 const std::string& additional_query,
54 ExtendedReportingLevel reporting_level);
55
56 private:
57 DISALLOW_IMPLICIT_CONSTRUCTORS(SafeBrowsingProtocolManagerHelper);
58 };
59
60 } // namespace safe_browsing
61
62 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.cc ('k') | chrome/browser/safe_browsing/protocol_manager_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698