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

Side by Side Diff: components/safe_browsing_db/safe_browsing_api_handler_util.h

Issue 1620813005: Revert of Move remote_db_manager into the safe_browsing_db component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 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 // Helper functions for SafeBrowsingApiHandlerImpl. Separated out for tests.
6
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_UTIL_H_
8 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_UTIL_H_
9
10 #include <string>
11
12 #include "components/safe_browsing_db/util.h"
13
14 namespace safe_browsing {
15
16 // These match what SafeBrowsingApiHandler.java uses for |resultStatus|
17 enum RemoteCallResultStatus {
18 RESULT_STATUS_INTERNAL_ERROR = -1,
19 RESULT_STATUS_SUCCESS = 0,
20 RESULT_STATUS_TIMEOUT = 1,
21 };
22
23 // Threat types as per the Java code.
24 // This must match those in GMS's SafeBrowsingThreatTypes.java.
25 enum JavaThreatTypes {
26 JAVA_THREAT_TYPE_POTENTIALLY_HARMFUL_APPLICATION = 4,
27 JAVA_THREAT_TYPE_SOCIAL_ENGINEERING = 5,
28 };
29
30 // Do not reorder or delete entries, and make sure changes here are reflected
31 // in SB2RemoteCallResult histogram.
32 enum UmaRemoteCallResult {
33 UMA_STATUS_INTERNAL_ERROR = 0,
34 UMA_STATUS_TIMEOUT = 1,
35 UMA_STATUS_SAFE = 2,
36 UMA_STATUS_UNSAFE = 3,
37 UMA_STATUS_JSON_EMPTY = 4,
38 UMA_STATUS_JSON_FAILED_TO_PARSE = 5,
39 UMA_STATUS_JSON_UNKNOWN_THREAT = 6,
40 UMA_STATUS_UNSUPPORTED = 7,
41 UMA_STATUS_MAX_VALUE
42 };
43
44 // This parses the JSON from the GMSCore API and then:
45 // 1) Picks the most severe threat type
46 // 2) Parses remaining key/value pairs into a MalwarePatternType PB
47 // so DisplayBlockingPage() can unmarshal it. We make this string
48 // is binary compatible with the Pver3 API's metadata string even
49 // though it comes from Pver4.
50 //
51 // If anything fails to parse, this sets the threat to "safe". The caller
52 // should report the return value via UMA.
53 UmaRemoteCallResult ParseJsonToThreatAndPB(const std::string& metadata_str,
54 SBThreatType* worst_threat,
55 std::string* metadata_pb_str);
56 } // namespace safe_browsing
57
58 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698