| OLD | NEW |
| 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/browser/safe_browsing/browser_feature_extractor.h" | 5 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 feature->set_value(feature_value); | 44 feature->set_value(feature_value); |
| 45 VLOG(2) << "Browser feature: " << feature->name() << " " << feature->value(); | 45 VLOG(2) << "Browser feature: " << feature->name() << " " << feature->value(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 static void AddNavigationFeatures(const std::string& feature_prefix, | 48 static void AddNavigationFeatures(const std::string& feature_prefix, |
| 49 const NavigationController& controller, | 49 const NavigationController& controller, |
| 50 int index, | 50 int index, |
| 51 const std::vector<GURL>& redirect_chain, | 51 const std::vector<GURL>& redirect_chain, |
| 52 ClientPhishingRequest* request) { | 52 ClientPhishingRequest* request) { |
| 53 NavigationEntry* entry = controller.GetEntryAtIndex(index); | 53 NavigationEntry* entry = controller.GetEntryAtIndex(index); |
| 54 bool is_secure_referrer = entry->referrer().SchemeIsSecure(); | 54 bool is_secure_referrer = entry->referrer().url.SchemeIsSecure(); |
| 55 if (!is_secure_referrer) { | 55 if (!is_secure_referrer) { |
| 56 AddFeature(StringPrintf("%s%s=%s", | 56 AddFeature(StringPrintf("%s%s=%s", |
| 57 feature_prefix.c_str(), | 57 feature_prefix.c_str(), |
| 58 features::kReferrer, | 58 features::kReferrer, |
| 59 entry->referrer().spec().c_str()), | 59 entry->referrer().url.spec().c_str()), |
| 60 1.0, | 60 1.0, |
| 61 request); | 61 request); |
| 62 } | 62 } |
| 63 AddFeature(feature_prefix + features::kHasSSLReferrer, | 63 AddFeature(feature_prefix + features::kHasSSLReferrer, |
| 64 is_secure_referrer ? 1.0 : 0.0, | 64 is_secure_referrer ? 1.0 : 0.0, |
| 65 request); | 65 request); |
| 66 AddFeature(feature_prefix + features::kPageTransitionType, | 66 AddFeature(feature_prefix + features::kPageTransitionType, |
| 67 static_cast<double>( | 67 static_cast<double>( |
| 68 content::PageTransitionStripQualifier( | 68 content::PageTransitionStripQualifier( |
| 69 entry->transition_type())), | 69 entry->transition_type())), |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 *history = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); | 438 *history = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 439 if (*history) { | 439 if (*history) { |
| 440 return true; | 440 return true; |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 VLOG(2) << "Unable to query history. No history service available."; | 443 VLOG(2) << "Unable to query history. No history service available."; |
| 444 return false; | 444 return false; |
| 445 } | 445 } |
| 446 | 446 |
| 447 } // namespace safe_browsing | 447 } // namespace safe_browsing |
| OLD | NEW |