| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // ThreatDOMDetails iterates over a document's frames and gathers | 5 // ThreatDOMDetails iterates over a document's frames and gathers |
| 6 // interesting URLs such as those of scripts and frames. When done, it sends | 6 // interesting URLs such as those of scripts and frames. When done, it sends |
| 7 // them to the ThreatDetails that requested them. | 7 // them to the ThreatDetails that requested them. |
| 8 | 8 |
| 9 #ifndef CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ | 9 #ifndef CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ |
| 10 #define CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ | 10 #define CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ |
| 11 | 11 |
| 12 #include <stdint.h> |
| 13 |
| 12 #include <vector> | 14 #include <vector> |
| 13 | 15 |
| 14 #include "base/basictypes.h" | |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" |
| 16 #include "content/public/renderer/render_view_observer.h" | 18 #include "content/public/renderer/render_view_observer.h" |
| 17 | 19 |
| 18 struct SafeBrowsingHostMsg_ThreatDOMDetails_Node; | 20 struct SafeBrowsingHostMsg_ThreatDOMDetails_Node; |
| 19 | 21 |
| 20 namespace safe_browsing { | 22 namespace safe_browsing { |
| 21 | 23 |
| 22 // There is one ThreatDOMDetails per RenderView. | 24 // There is one ThreatDOMDetails per RenderView. |
| 23 class ThreatDOMDetails : public content::RenderViewObserver { | 25 class ThreatDOMDetails : public content::RenderViewObserver { |
| 24 public: | 26 public: |
| 25 // An upper limit on the number of nodes we collect. Not const for the test. | 27 // An upper limit on the number of nodes we collect. Not const for the test. |
| 26 static uint32 kMaxNodes; | 28 static uint32_t kMaxNodes; |
| 27 | 29 |
| 28 static ThreatDOMDetails* Create(content::RenderView* render_view); | 30 static ThreatDOMDetails* Create(content::RenderView* render_view); |
| 29 ~ThreatDOMDetails() override; | 31 ~ThreatDOMDetails() override; |
| 30 | 32 |
| 31 // Begins extracting resource urls for the page currently loaded in | 33 // Begins extracting resource urls for the page currently loaded in |
| 32 // this object's RenderView. | 34 // this object's RenderView. |
| 33 // Exposed for testing. | 35 // Exposed for testing. |
| 34 void ExtractResources( | 36 void ExtractResources( |
| 35 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>* resources); | 37 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>* resources); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 // Creates a ThreatDOMDetails for the specified RenderView. | 40 // Creates a ThreatDOMDetails for the specified RenderView. |
| 39 // The ThreatDOMDetails should be destroyed prior to destroying | 41 // The ThreatDOMDetails should be destroyed prior to destroying |
| 40 // the RenderView. | 42 // the RenderView. |
| 41 explicit ThreatDOMDetails(content::RenderView* render_view); | 43 explicit ThreatDOMDetails(content::RenderView* render_view); |
| 42 | 44 |
| 43 // RenderViewObserver implementation. | 45 // RenderViewObserver implementation. |
| 44 bool OnMessageReceived(const IPC::Message& message) override; | 46 bool OnMessageReceived(const IPC::Message& message) override; |
| 45 | 47 |
| 46 void OnGetThreatDOMDetails(); | 48 void OnGetThreatDOMDetails(); |
| 47 | 49 |
| 48 DISALLOW_COPY_AND_ASSIGN(ThreatDOMDetails); | 50 DISALLOW_COPY_AND_ASSIGN(ThreatDOMDetails); |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace safe_browsing | 53 } // namespace safe_browsing |
| 52 | 54 |
| 53 #endif // CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ | 55 #endif // CHROME_RENDERER_SAFE_BROWSING_THREAT_DOM_DETAILS_H_ |
| OLD | NEW |