Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / safe_browsing / protocol_manager_helper.h
blob178264fa5c484a37755fa57fda7d5153edac26de
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.
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_
8 // A class that provides common functionality for safebrowsing protocol managers
9 // that communicate with Google servers.
11 #include <string>
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
16 #include "base/gtest_prod_util.h"
18 struct SafeBrowsingProtocolConfig {
19 SafeBrowsingProtocolConfig();
20 ~SafeBrowsingProtocolConfig();
21 std::string client_name;
22 std::string url_prefix;
23 std::string backup_connect_error_url_prefix;
24 std::string backup_http_error_url_prefix;
25 std::string backup_network_error_url_prefix;
26 std::string version;
27 bool disable_auto_update;
28 #if defined(OS_ANDROID)
29 bool disable_connection_check;
30 #endif
33 class SafeBrowsingProtocolManagerHelper {
34 public:
35 // returns version
36 static std::string Version();
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);
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 bool is_extended_reporting);
56 private:
57 DISALLOW_IMPLICIT_CONSTRUCTORS(SafeBrowsingProtocolManagerHelper);
60 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_