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

Side by Side Diff: components/safe_browsing/renderer/scorer.cc

Issue 2667343006: Componentize safe_browsing [X+1] : move the renderer part to component.
Patch Set: 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/renderer/safe_browsing/scorer.h" 5 #include "components/safe_browsing/renderer/scorer.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 // TODO(timvolodine): move proto to components
14 #include "chrome/common/safe_browsing/client_model.pb.h" 15 #include "chrome/common/safe_browsing/client_model.pb.h"
15 #include "chrome/renderer/safe_browsing/features.h" 16 #include "components/safe_browsing/renderer/features.h"
16 17
17 namespace { 18 namespace {
18 // Enum used to keep stats about the status of the Scorer creation. 19 // Enum used to keep stats about the status of the Scorer creation.
19 enum ScorerCreationStatus { 20 enum ScorerCreationStatus {
20 SCORER_SUCCESS, 21 SCORER_SUCCESS,
21 SCORER_FAIL_MODEL_OPEN_FAIL, // Not used anymore 22 SCORER_FAIL_MODEL_OPEN_FAIL, // Not used anymore
22 SCORER_FAIL_MODEL_FILE_EMPTY, // Not used anymore 23 SCORER_FAIL_MODEL_FILE_EMPTY, // Not used anymore
23 SCORER_FAIL_MODEL_FILE_TOO_LARGE, // Not used anymore 24 SCORER_FAIL_MODEL_FILE_TOO_LARGE, // Not used anymore
24 SCORER_FAIL_MODEL_PARSE_ERROR, 25 SCORER_FAIL_MODEL_PARSE_ERROR,
25 SCORER_FAIL_MODEL_MISSING_FIELDS, 26 SCORER_FAIL_MODEL_MISSING_FIELDS,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // If the feature of the rule does not exist in the given feature map the 124 // If the feature of the rule does not exist in the given feature map the
124 // feature weight is considered to be zero. If the feature weight is zero 125 // feature weight is considered to be zero. If the feature weight is zero
125 // we leave early since we know that the rule score will be zero. 126 // we leave early since we know that the rule score will be zero.
126 return 0.0; 127 return 0.0;
127 } 128 }
128 rule_score *= it->second; 129 rule_score *= it->second;
129 } 130 }
130 return rule_score * rule.weight(); 131 return rule_score * rule.weight();
131 } 132 }
132 } // namespace safe_browsing 133 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing/renderer/scorer.h ('k') | components/safe_browsing/renderer/scorer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698