OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/timer/elapsed_timer.h" | 14 #include "base/timer/elapsed_timer.h" |
15 #include "extensions/common/user_script.h" | 15 #include "extensions/common/user_script.h" |
16 | 16 |
17 namespace blink { | 17 namespace content { |
18 class WebLocalFrame; | 18 class RenderFrame; |
19 } | 19 } |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
23 // A struct containing information about a script run. | 23 // A struct containing information about a script run. |
24 struct ScriptsRunInfo { | 24 struct ScriptsRunInfo { |
25 // Map of extensions IDs to the executing script paths. | 25 // Map of extensions IDs to the executing script paths. |
26 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; | 26 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; |
27 | 27 |
28 ScriptsRunInfo(); | 28 ScriptsRunInfo(content::RenderFrame* render_frame, |
| 29 UserScript::RunLocation location); |
29 ~ScriptsRunInfo(); | 30 ~ScriptsRunInfo(); |
30 | 31 |
31 // The number of CSS scripts injected. | 32 // The number of CSS scripts injected. |
32 size_t num_css; | 33 size_t num_css; |
33 // The number of JS scripts injected. | 34 // The number of JS scripts injected. |
34 size_t num_js; | 35 size_t num_js; |
35 // The number of blocked JS scripts injected. | 36 // The number of blocked JS scripts injected. |
36 size_t num_blocking_js; | 37 size_t num_blocking_js; |
37 // A map of extension ids to executing script paths. | 38 // A map of extension ids to executing script paths. |
38 ExecutingScriptsMap executing_scripts; | 39 ExecutingScriptsMap executing_scripts; |
39 // The elapsed time since the ScriptsRunInfo was constructed. | 40 // The elapsed time since the ScriptsRunInfo was constructed. |
40 base::ElapsedTimer timer; | 41 base::ElapsedTimer timer; |
41 | 42 |
42 // Log information about a given script run. | 43 // Log information about a given script run. |
43 void LogRun(blink::WebLocalFrame* frame, UserScript::RunLocation location); | 44 void LogRun(); |
44 | 45 |
45 private: | 46 private: |
| 47 // The routinig id to use to notify the browser of any injections. Since the |
| 48 // frame may be deleted in injection, we don't hold on to a reference to it |
| 49 // directly. |
| 50 int routing_id_; |
| 51 |
| 52 // The run location at which injection is happening. |
| 53 UserScript::RunLocation run_location_; |
| 54 |
| 55 // The url of the frame, preserved for the same reason as the routing id. |
| 56 GURL frame_url_; |
| 57 |
46 DISALLOW_COPY_AND_ASSIGN(ScriptsRunInfo); | 58 DISALLOW_COPY_AND_ASSIGN(ScriptsRunInfo); |
47 }; | 59 }; |
48 | 60 |
49 } // namespace extensions | 61 } // namespace extensions |
50 | 62 |
51 #endif // EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ | 63 #endif // EXTENSIONS_RENDERER_SCRIPTS_RUN_INFO_H_ |
OLD | NEW |