OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ |
7 | 7 |
8 // A class that provides common functionality for safebrowsing protocol managers | 8 // A class that provides common functionality for safebrowsing protocol managers |
9 // that communicate with Google servers. | 9 // that communicate with Google servers. |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 | 15 |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 | 17 |
18 struct SafeBrowsingProtocolConfig { | 18 struct SafeBrowsingProtocolConfig { |
19 SafeBrowsingProtocolConfig(); | 19 SafeBrowsingProtocolConfig(); |
20 ~SafeBrowsingProtocolConfig(); | 20 ~SafeBrowsingProtocolConfig(); |
21 std::string client_name; | 21 std::string client_name; |
22 std::string url_prefix; | 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; |
23 std::string version; | 26 std::string version; |
24 bool disable_auto_update; | 27 bool disable_auto_update; |
25 }; | 28 }; |
26 | 29 |
27 class SafeBrowsingProtocolManagerHelper { | 30 class SafeBrowsingProtocolManagerHelper { |
28 public: | 31 public: |
29 // returns version | 32 // returns version |
30 static std::string Version(); | 33 static std::string Version(); |
31 | 34 |
32 // Composes a URL using |prefix|, |method| (e.g.: gethash, download, report). | 35 // Composes a URL using |prefix|, |method| (e.g.: gethash, download, report). |
33 // |client_name| and |version|. When not empty, |additional_query| is | 36 // |client_name| and |version|. When not empty, |additional_query| is |
34 // appended to the URL with an additional "&" in the front. | 37 // appended to the URL with an additional "&" in the front. |
35 static std::string ComposeUrl(const std::string& prefix, | 38 static std::string ComposeUrl(const std::string& prefix, |
36 const std::string& method, | 39 const std::string& method, |
37 const std::string& client_name, | 40 const std::string& client_name, |
38 const std::string& version, | 41 const std::string& version, |
39 const std::string& additional_query); | 42 const std::string& additional_query); |
40 | 43 |
41 private: | 44 private: |
42 DISALLOW_IMPLICIT_CONSTRUCTORS(SafeBrowsingProtocolManagerHelper); | 45 DISALLOW_IMPLICIT_CONSTRUCTORS(SafeBrowsingProtocolManagerHelper); |
43 }; | 46 }; |
44 | 47 |
45 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ | 48 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_HELPER_H_ |
OLD | NEW |