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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
18 #include "chrome/browser/history/history_types.h" | 18 #include "chrome/browser/history/history_types.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/safe_browsing/browser_features.h" | 20 #include "chrome/browser/safe_browsing/browser_features.h" |
21 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 21 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
22 #include "chrome/common/safe_browsing/csd.pb.h" | 22 #include "chrome/common/safe_browsing/csd.pb.h" |
23 #include "content/browser/cancelable_request.h" | 23 #include "content/browser/cancelable_request.h" |
24 #include "content/browser/tab_contents/tab_contents.h" | |
25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/web_contents.h" |
26 #include "content/public/common/page_transition_types.h" | 26 #include "content/public/common/page_transition_types.h" |
27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
28 | 28 |
29 using content::BrowserThread; | 29 using content::BrowserThread; |
| 30 using content::WebContents; |
30 | 31 |
31 namespace safe_browsing { | 32 namespace safe_browsing { |
32 | 33 |
33 BrowseInfo::BrowseInfo() : http_status_code(0) {} | 34 BrowseInfo::BrowseInfo() : http_status_code(0) {} |
34 | 35 |
35 BrowseInfo::~BrowseInfo() {} | 36 BrowseInfo::~BrowseInfo() {} |
36 | 37 |
37 static void AddFeature(const std::string& feature_name, | 38 static void AddFeature(const std::string& feature_name, |
38 double feature_value, | 39 double feature_value, |
39 ClientPhishingRequest* request) { | 40 ClientPhishingRequest* request) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 feature_prefix.c_str(), | 101 feature_prefix.c_str(), |
101 features::kRedirect, | 102 features::kRedirect, |
102 i, | 103 i, |
103 printable_redirect.c_str()), | 104 printable_redirect.c_str()), |
104 1.0, | 105 1.0, |
105 request); | 106 request); |
106 } | 107 } |
107 } | 108 } |
108 | 109 |
109 BrowserFeatureExtractor::BrowserFeatureExtractor( | 110 BrowserFeatureExtractor::BrowserFeatureExtractor( |
110 TabContents* tab, | 111 WebContents* tab, |
111 ClientSideDetectionService* service) | 112 ClientSideDetectionService* service) |
112 : tab_(tab), | 113 : tab_(tab), |
113 service_(service), | 114 service_(service), |
114 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 115 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
115 DCHECK(tab); | 116 DCHECK(tab); |
116 } | 117 } |
117 | 118 |
118 BrowserFeatureExtractor::~BrowserFeatureExtractor() { | 119 BrowserFeatureExtractor::~BrowserFeatureExtractor() { |
119 weak_factory_.InvalidateWeakPtrs(); | 120 weak_factory_.InvalidateWeakPtrs(); |
120 // Delete all the pending extractions (delete callback and request objects). | 121 // Delete all the pending extractions (delete callback and request objects). |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 *history = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); | 439 *history = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); |
439 if (*history) { | 440 if (*history) { |
440 return true; | 441 return true; |
441 } | 442 } |
442 } | 443 } |
443 VLOG(2) << "Unable to query history. No history service available."; | 444 VLOG(2) << "Unable to query history. No history service available."; |
444 return false; | 445 return false; |
445 } | 446 } |
446 | 447 |
447 } // namespace safe_browsing | 448 } // namespace safe_browsing |
OLD | NEW |