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.
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_
14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h"
16 #include "content/public/renderer/render_view_observer.h"
18 struct SafeBrowsingHostMsg_MalwareDOMDetails_Node
;
20 namespace safe_browsing
{
22 // There is one MalwareDOMDetails per RenderView.
23 class MalwareDOMDetails
: public content::RenderViewObserver
{
25 // An upper limit on the number of nodes we collect. Not const for the test.
26 static uint32 kMaxNodes
;
28 static MalwareDOMDetails
* Create(content::RenderView
* render_view
);
29 ~MalwareDOMDetails() override
;
31 // Begins extracting resource urls for the page currently loaded in
32 // this object's RenderView.
33 // Exposed for testing.
34 void ExtractResources(
35 std::vector
<SafeBrowsingHostMsg_MalwareDOMDetails_Node
>* resources
);
38 // Creates a MalwareDOMDetails for the specified RenderView.
39 // The MalwareDOMDetails should be destroyed prior to destroying
41 explicit MalwareDOMDetails(content::RenderView
* render_view
);
43 // RenderViewObserver implementation.
44 bool OnMessageReceived(const IPC::Message
& message
) override
;
46 void OnGetMalwareDOMDetails();
48 DISALLOW_COPY_AND_ASSIGN(MalwareDOMDetails
);
51 } // namespace safe_browsing
53 #endif // CHROME_RENDERER_SAFE_BROWSING_MALWARE_DOM_DETAILS_H_