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

Side by Side Diff: chrome/browser/safe_browsing/browser_feature_extractor.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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 #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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 static void AddNavigationFeatures( 53 static void AddNavigationFeatures(
54 const std::string& feature_prefix, 54 const std::string& feature_prefix,
55 const NavigationController& controller, 55 const NavigationController& controller,
56 int index, 56 int index,
57 const std::vector<GURL>& redirect_chain, 57 const std::vector<GURL>& redirect_chain,
58 ClientPhishingRequest* request) { 58 ClientPhishingRequest* request) {
59 NavigationEntry* entry = controller.GetEntryAtIndex(index); 59 NavigationEntry* entry = controller.GetEntryAtIndex(index);
60 bool is_secure_referrer = entry->GetReferrer().url.SchemeIsSecure(); 60 bool is_secure_referrer = entry->GetReferrer().url.SchemeIsSecure();
61 if (!is_secure_referrer) { 61 if (!is_secure_referrer) {
62 AddFeature(StringPrintf("%s%s=%s", 62 AddFeature(base::StringPrintf("%s%s=%s",
63 feature_prefix.c_str(), 63 feature_prefix.c_str(),
64 features::kReferrer, 64 features::kReferrer,
65 entry->GetReferrer().url.spec().c_str()), 65 entry->GetReferrer().url.spec().c_str()),
66 1.0, 66 1.0,
67 request); 67 request);
68 } 68 }
69 AddFeature(feature_prefix + features::kHasSSLReferrer, 69 AddFeature(feature_prefix + features::kHasSSLReferrer,
70 is_secure_referrer ? 1.0 : 0.0, 70 is_secure_referrer ? 1.0 : 0.0,
71 request); 71 request);
72 AddFeature(feature_prefix + features::kPageTransitionType, 72 AddFeature(feature_prefix + features::kPageTransitionType,
73 static_cast<double>( 73 static_cast<double>(
74 content::PageTransitionStripQualifier( 74 content::PageTransitionStripQualifier(
75 entry->GetTransitionType())), 75 entry->GetTransitionType())),
(...skipping 19 matching lines...) Expand all
95 1.0, 95 1.0,
96 request); 96 request);
97 return; 97 return;
98 } 98 }
99 // We skip the last element since it should just be the current url. 99 // We skip the last element since it should just be the current url.
100 for (size_t i = 0; i < redirect_chain.size() - 1; i++) { 100 for (size_t i = 0; i < redirect_chain.size() - 1; i++) {
101 std::string printable_redirect = redirect_chain[i].spec(); 101 std::string printable_redirect = redirect_chain[i].spec();
102 if (redirect_chain[i].SchemeIsSecure()) { 102 if (redirect_chain[i].SchemeIsSecure()) {
103 printable_redirect = features::kSecureRedirectValue; 103 printable_redirect = features::kSecureRedirectValue;
104 } 104 }
105 AddFeature(StringPrintf("%s%s[%"PRIuS"]=%s", 105 AddFeature(base::StringPrintf("%s%s[%"PRIuS"]=%s",
106 feature_prefix.c_str(), 106 feature_prefix.c_str(),
107 features::kRedirect, 107 features::kRedirect,
108 i, 108 i,
109 printable_redirect.c_str()), 109 printable_redirect.c_str()),
110 1.0, 110 1.0,
111 request); 111 request);
112 } 112 }
113 } 113 }
114 114
115 BrowserFeatureExtractor::BrowserFeatureExtractor( 115 BrowserFeatureExtractor::BrowserFeatureExtractor(
116 WebContents* tab, 116 WebContents* tab,
117 ClientSideDetectionService* service) 117 ClientSideDetectionService* service)
118 : tab_(tab), 118 : tab_(tab),
119 service_(service), 119 service_(service),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 Profile::EXPLICIT_ACCESS); 445 Profile::EXPLICIT_ACCESS);
446 if (*history) { 446 if (*history) {
447 return true; 447 return true;
448 } 448 }
449 } 449 }
450 VLOG(2) << "Unable to query history. No history service available."; 450 VLOG(2) << "Unable to query history. No history service available.";
451 return false; 451 return false;
452 } 452 }
453 453
454 } // namespace safe_browsing 454 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698