summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/safe_browsing
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/safe_browsing')
-rw-r--r--chrome/renderer/safe_browsing/malware_dom_details.cc25
-rw-r--r--chrome/renderer/safe_browsing/phishing_classifier.cc5
-rw-r--r--chrome/renderer/safe_browsing/phishing_classifier_delegate.cc3
-rw-r--r--chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc4
4 files changed, 19 insertions, 18 deletions
diff --git a/chrome/renderer/safe_browsing/malware_dom_details.cc b/chrome/renderer/safe_browsing/malware_dom_details.cc
index f2d96bd..866cae8 100644
--- a/chrome/renderer/safe_browsing/malware_dom_details.cc
+++ b/chrome/renderer/safe_browsing/malware_dom_details.cc
@@ -59,20 +59,19 @@ void MalwareDOMDetails::ExtractResources(
NOTREACHED();
return;
}
- WebKit::WebFrame* cur_frame = web_view->mainFrame();
- for (; cur_frame;
- cur_frame = cur_frame->traverseNext(false /* don't wrap around */)) {
- DCHECK(cur_frame);
- SafeBrowsingHostMsg_MalwareDOMDetails_Node frame_node;
- frame_node.url = GURL(cur_frame->url());
- WebKit::WebDocument doc = cur_frame->document();
- if (doc.isNull()) {
+ WebKit::WebFrame* frame = web_view->mainFrame();
+ for (; frame; frame = frame->traverseNext(false /* don't wrap */)) {
+ DCHECK(frame);
+ SafeBrowsingHostMsg_MalwareDOMDetails_Node details_node;
+ WebKit::WebDocument document = frame->document();
+ details_node.url = GURL(document.url());
+ if (document.isNull()) {
// Nothing in this frame, move on to the next one.
- resources->push_back(frame_node);
+ resources->push_back(details_node);
continue;
}
- WebKit::WebNodeCollection elements = doc.all();
+ WebKit::WebNodeCollection elements = document.all();
WebKit::WebNode cur_node = elements.firstItem();
for (; !cur_node.isNull(); cur_node = elements.nextItem()) {
if (!cur_node.isElementNode()) {
@@ -81,16 +80,16 @@ void MalwareDOMDetails::ExtractResources(
WebKit::WebElement element = cur_node.to<WebKit::WebElement>();
if (element.hasTagName("iframe") || element.hasTagName("frame") ||
element.hasTagName("embed") || element.hasTagName("script")) {
- HandleElement(element, &frame_node, resources);
+ HandleElement(element, &details_node, resources);
if (resources->size() >= kMaxNodes) {
// We have reached kMaxNodes, exit early.
- resources->push_back(frame_node);
+ resources->push_back(details_node);
return;
}
}
}
- resources->push_back(frame_node);
+ resources->push_back(details_node);
}
}
diff --git a/chrome/renderer/safe_browsing/phishing_classifier.cc b/chrome/renderer/safe_browsing/phishing_classifier.cc
index e64cfc3..f2323d1 100644
--- a/chrome/renderer/safe_browsing/phishing_classifier.cc
+++ b/chrome/renderer/safe_browsing/phishing_classifier.cc
@@ -24,6 +24,7 @@
#include "crypto/sha2.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
@@ -105,7 +106,7 @@ void PhishingClassifier::BeginFeatureExtraction() {
// Check whether the URL is one that we should classify.
// Currently, we only classify http: URLs that are GET requests.
- GURL url(frame->url());
+ GURL url(frame->document().url());
if (!url.SchemeIs(chrome::kHttpScheme)) {
RunFailureCallback();
return;
@@ -171,7 +172,7 @@ void PhishingClassifier::TermExtractionFinished(bool success) {
FeatureMap hashed_features;
ClientPhishingRequest verdict;
verdict.set_model_version(scorer_->model_version());
- verdict.set_url(main_frame->url().spec());
+ verdict.set_url(main_frame->document().url().spec());
for (base::hash_map<std::string, double>::const_iterator it =
features_->features().begin();
it != features_->features().end(); ++it) {
diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc
index 814dab4..a276d5a 100644
--- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc
+++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc
@@ -19,6 +19,7 @@
#include "content/renderer/navigation_state.h"
#include "content/renderer/render_thread.h"
#include "content/renderer/render_view.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
@@ -207,7 +208,7 @@ void PhishingClassifierDelegate::ClassificationDone(
}
GURL PhishingClassifierDelegate::GetToplevelUrl() {
- return render_view()->webview()->mainFrame()->url();
+ return render_view()->webview()->mainFrame()->document().url();
}
void PhishingClassifierDelegate::MaybeStartClassification() {
diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
index e7f6d32..9b00045 100644
--- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
+++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -391,7 +391,7 @@ bool PhishingDOMFeatureExtractor::ResetFrameData() {
cur_frame_data_->elements = doc.all();
cur_frame_data_->domain =
net::RegistryControlledDomainService::GetDomainAndRegistry(
- cur_frame_->url());
+ cur_frame_->document().url());
return true;
}