| 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 #include "extensions/renderer/user_script_injector.h" | 5 #include "extensions/renderer/user_script_injector.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 using RoutingInfoMap = std::map<RoutingInfoKey, bool>; | 45 using RoutingInfoMap = std::map<RoutingInfoKey, bool>; |
| 46 | 46 |
| 47 // A map records whether a given |script_id| from a webview-added user script | 47 // A map records whether a given |script_id| from a webview-added user script |
| 48 // is allowed to inject on the render of given |routing_id|. | 48 // is allowed to inject on the render of given |routing_id|. |
| 49 // Once a script is added, the decision of whether or not allowed to inject | 49 // Once a script is added, the decision of whether or not allowed to inject |
| 50 // won't be changed. | 50 // won't be changed. |
| 51 // After removed by the webview, the user scipt will also be removed | 51 // After removed by the webview, the user scipt will also be removed |
| 52 // from the render. Therefore, there won't be any query from the same | 52 // from the render. Therefore, there won't be any query from the same |
| 53 // |script_id| and |routing_id| pair. | 53 // |script_id| and |routing_id| pair. |
| 54 base::LazyInstance<RoutingInfoMap> g_routing_info_map = | 54 base::LazyInstance<RoutingInfoMap>::DestructorAtExit g_routing_info_map = |
| 55 LAZY_INSTANCE_INITIALIZER; | 55 LAZY_INSTANCE_INITIALIZER; |
| 56 | 56 |
| 57 // Greasemonkey API source that is injected with the scripts. | 57 // Greasemonkey API source that is injected with the scripts. |
| 58 struct GreasemonkeyApiJsString { | 58 struct GreasemonkeyApiJsString { |
| 59 GreasemonkeyApiJsString(); | 59 GreasemonkeyApiJsString(); |
| 60 blink::WebScriptSource GetSource() const; | 60 blink::WebScriptSource GetSource() const; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 blink::WebString source_; | 63 blink::WebString source_; |
| 64 }; | 64 }; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 void UserScriptInjector::OnInjectionComplete( | 268 void UserScriptInjector::OnInjectionComplete( |
| 269 std::unique_ptr<base::Value> execution_result, | 269 std::unique_ptr<base::Value> execution_result, |
| 270 UserScript::RunLocation run_location, | 270 UserScript::RunLocation run_location, |
| 271 content::RenderFrame* render_frame) {} | 271 content::RenderFrame* render_frame) {} |
| 272 | 272 |
| 273 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason, | 273 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason, |
| 274 content::RenderFrame* render_frame) { | 274 content::RenderFrame* render_frame) { |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace extensions | 277 } // namespace extensions |
| OLD | NEW |