summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/safe_browsing/malware_dom_details.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/safe_browsing/malware_dom_details.cc')
-rw-r--r--chrome/renderer/safe_browsing/malware_dom_details.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/chrome/renderer/safe_browsing/malware_dom_details.cc b/chrome/renderer/safe_browsing/malware_dom_details.cc
index 79624dd..6a03295 100644
--- a/chrome/renderer/safe_browsing/malware_dom_details.cc
+++ b/chrome/renderer/safe_browsing/malware_dom_details.cc
@@ -6,8 +6,7 @@
#include "base/compiler_specific.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/render_messages.h"
-#include "chrome/common/render_messages_params.h"
+#include "chrome/common/safebrowsing_messages.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/WebElement.h"
@@ -32,22 +31,22 @@ MalwareDOMDetails::~MalwareDOMDetails() {
bool MalwareDOMDetails::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(MalwareDOMDetails, message)
- IPC_MESSAGE_HANDLER(ViewMsg_GetMalwareDOMDetails, OnGetMalwareDOMDetails)
+ IPC_MESSAGE_HANDLER(SafeBrowsingMsg_GetMalwareDOMDetails, OnGetMalwareDOMDetails)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void MalwareDOMDetails::OnGetMalwareDOMDetails() {
- ViewHostMsg_MalwareDOMDetails_Params resources;
+ std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> resources;
ExtractResources(&resources);
// Notify the browser.
- render_view()->Send(new ViewHostMsg_MalwareDOMDetails(
+ render_view()->Send(new SafeBrowsingHostMsg_MalwareDOMDetails(
render_view()->routing_id(), resources));
}
void MalwareDOMDetails::ExtractResources(
- ViewHostMsg_MalwareDOMDetails_Params* resources) {
+ std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources) {
WebKit::WebView* web_view = render_view_->webview();
if (!web_view) {
NOTREACHED();
@@ -57,12 +56,12 @@ void MalwareDOMDetails::ExtractResources(
for (; cur_frame;
cur_frame = cur_frame->traverseNext(false /* don't wrap around */)) {
DCHECK(cur_frame);
- ViewHostMsg_MalwareDOMDetails_Node frame_node;
+ SafeBrowsingHostMsg_MalwareDOMDetails_Node frame_node;
frame_node.url = GURL(cur_frame->url());
WebKit::WebDocument doc = cur_frame->document();
if (doc.isNull()) {
// Nothing in this frame, move on to the next one.
- resources->nodes.push_back(frame_node);
+ resources->push_back(frame_node);
continue;
}
@@ -76,22 +75,22 @@ void MalwareDOMDetails::ExtractResources(
if (element.hasTagName("iframe") || element.hasTagName("frame") ||
element.hasTagName("embed") || element.hasTagName("script")) {
HandleElement(element, &frame_node, resources);
- if (resources->nodes.size() >= kMaxNodes) {
+ if (resources->size() >= kMaxNodes) {
// We have reached kMaxNodes, exit early.
- resources->nodes.push_back(frame_node);
+ resources->push_back(frame_node);
return;
}
}
}
- resources->nodes.push_back(frame_node);
+ resources->push_back(frame_node);
}
}
void MalwareDOMDetails::HandleElement(
const WebKit::WebElement& element,
- ViewHostMsg_MalwareDOMDetails_Node* parent_node,
- ViewHostMsg_MalwareDOMDetails_Params* resources) {
+ SafeBrowsingHostMsg_MalwareDOMDetails_Node* parent_node,
+ std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources) {
if (!element.hasAttribute("src")) {
return;
}
@@ -106,11 +105,11 @@ void MalwareDOMDetails::HandleElement(
parent_node->children.push_back(child_url);
// Create the child node.
- ViewHostMsg_MalwareDOMDetails_Node child_node;
+ SafeBrowsingHostMsg_MalwareDOMDetails_Node child_node;
child_node.url = child_url;
child_node.tag_name = element.tagName().utf8();
child_node.parent = parent_node->url;
- resources->nodes.push_back(child_node);
+ resources->push_back(child_node);
}
} // namespace safe_browsing