Add a function to create a bookmark app from a WebApplicationInfo.
[chromium-blink-merge.git] / chrome / renderer / safe_browsing / malware_dom_details.h
blobf49d2f2c2dd0925923d206dae18c5a1b99dc46bd
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
3 // found in the LICENSE file.
4 //
5 // MalwareDOMDetails iterates over a document's frames and gathers
6 // interesting URLs such as those of scripts and frames. When done, it sends
7 // them to the MalwareDetails that requested them.
9 #ifndef CHROME_RENDERER_SAFE_BROWSING_MALWARE_DOM_DETAILS_H_
10 #define CHROME_RENDERER_SAFE_BROWSING_MALWARE_DOM_DETAILS_H_
12 #include <vector>
14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h"
16 #include "content/public/renderer/render_view_observer.h"
18 namespace blink {
19 class WebElement;
22 struct SafeBrowsingHostMsg_MalwareDOMDetails_Node;
24 namespace safe_browsing {
26 // There is one MalwareDOMDetails per RenderView.
27 class MalwareDOMDetails : public content::RenderViewObserver {
28 public:
29 // An upper limit on the number of nodes we collect. Not const for the test.
30 static uint32 kMaxNodes;
32 static MalwareDOMDetails* Create(content::RenderView* render_view);
33 virtual ~MalwareDOMDetails();
35 // Begins extracting resource urls for the page currently loaded in
36 // this object's RenderView.
37 void ExtractResources(
38 std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources);
40 private:
41 // Creates a MalwareDOMDetails for the specified RenderView.
42 // The MalwareDOMDetails should be destroyed prior to destroying
43 // the RenderView.
44 explicit MalwareDOMDetails(content::RenderView* render_view);
46 // RenderViewObserver implementation.
47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
49 void OnGetMalwareDOMDetails();
51 // Handler for the various HTML elements that we extract URLs from.
52 void HandleElement(
53 const blink::WebElement& element,
54 SafeBrowsingHostMsg_MalwareDOMDetails_Node* parent_node,
55 std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources);
57 DISALLOW_COPY_AND_ASSIGN(MalwareDOMDetails);
60 } // namespace safe_browsing
62 #endif // CHROME_RENDERER_SAFE_BROWSING_MALWARE_DOM_DETAILS_H_