| 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_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 5 #ifndef EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
| 6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 std::vector<std::string> GetCssSources( | 43 std::vector<std::string> GetCssSources( |
| 44 UserScript::RunLocation run_location) const override; | 44 UserScript::RunLocation run_location) const override; |
| 45 void GetRunInfo(ScriptsRunInfo* scripts_run_info, | 45 void GetRunInfo(ScriptsRunInfo* scripts_run_info, |
| 46 UserScript::RunLocation run_location) const override; | 46 UserScript::RunLocation run_location) const override; |
| 47 void OnInjectionComplete(scoped_ptr<base::Value> execution_result, | 47 void OnInjectionComplete(scoped_ptr<base::Value> execution_result, |
| 48 UserScript::RunLocation run_location, | 48 UserScript::RunLocation run_location, |
| 49 content::RenderFrame* render_frame) override; | 49 content::RenderFrame* render_frame) override; |
| 50 void OnWillNotInject(InjectFailureReason reason, | 50 void OnWillNotInject(InjectFailureReason reason, |
| 51 content::RenderFrame* render_frame) override; | 51 content::RenderFrame* render_frame) override; |
| 52 | 52 |
| 53 // Whether it is safe to include information about the URL in error messages. |
| 54 bool CanShowUrlInError() const; |
| 55 |
| 53 // Return the run location for this injector. | 56 // Return the run location for this injector. |
| 54 UserScript::RunLocation GetRunLocation() const; | 57 UserScript::RunLocation GetRunLocation() const; |
| 55 | 58 |
| 56 // Notify the browser that the script was injected (or never will be), and | 59 // Notify the browser that the script was injected (or never will be), and |
| 57 // send along any results or errors. | 60 // send along any results or errors. |
| 58 void Finish(const std::string& error, content::RenderFrame* render_frame); | 61 void Finish(const std::string& error, content::RenderFrame* render_frame); |
| 59 | 62 |
| 60 // The parameters for injecting the script. | 63 // The parameters for injecting the script. |
| 61 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_; | 64 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_; |
| 62 | 65 |
| 63 // The url of the frame into which we are injecting. | 66 // The url of the frame into which we are injecting. |
| 64 GURL url_; | 67 GURL url_; |
| 65 | 68 |
| 66 // The URL of the frame's origin. This is usually identical to |url_|, but | 69 // The serialization of the frame's origin if the frame is an about:-URL. This |
| 67 // could be different for e.g. about:blank URLs. Do not use this value to make | 70 // is used to provide user-friendly messages. |
| 68 // security decisions, to avoid race conditions (e.g. due to navigation). | 71 std::string origin_for_about_error_; |
| 69 GURL effective_url_; | |
| 70 | 72 |
| 71 // The results of the script execution. | 73 // The results of the script execution. |
| 72 base::ListValue results_; | 74 base::ListValue results_; |
| 73 | 75 |
| 74 // Whether or not this script injection has finished. | 76 // Whether or not this script injection has finished. |
| 75 bool finished_; | 77 bool finished_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); | 79 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace extensions | 82 } // namespace extensions |
| 81 | 83 |
| 82 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 84 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
| OLD | NEW |