| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ | 5 #ifndef EXTENSIONS_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ |
| 6 #define EXTENSIONS_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ | 6 #define EXTENSIONS_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Called at the end of each fetch, tracking whether all fetches are done. | 39 // Called at the end of each fetch, tracking whether all fetches are done. |
| 40 void OnSingleWebUIURLFetchComplete(extensions::UserScript::File* script_file, | 40 void OnSingleWebUIURLFetchComplete(extensions::UserScript::File* script_file, |
| 41 bool success, | 41 bool success, |
| 42 const std::string& data); | 42 const std::string& data); |
| 43 | 43 |
| 44 // Called when the loads of the user scripts are done. | 44 // Called when the loads of the user scripts are done. |
| 45 void OnWebUIURLFetchComplete(); | 45 void OnWebUIURLFetchComplete(); |
| 46 | 46 |
| 47 // Creates WebUiURLFetchers for the given |script_files|. | 47 // Creates WebUiURLFetchers for the given |script_files|. |
| 48 void CreateWebUIURLFetchers(extensions::UserScript::FileList* script_files, | 48 void CreateWebUIURLFetchers(extensions::UserScript::FileList* script_files, |
| 49 content::BrowserContext* browser_context, |
| 49 int render_process_id, | 50 int render_process_id, |
| 50 int render_view_id); | 51 int render_view_id); |
| 51 | 52 |
| 52 // Caches the render info of script from WebUI when AddScripts is called. | 53 // Caches the render info of script from WebUI when AddScripts is called. |
| 53 // When starting to load the script, we look up this map to retrieve the | 54 // When starting to load the script, we look up this map to retrieve the |
| 54 // render info. It is used for the script from WebUI only, since the fetch | 55 // render info. It is used for the script from WebUI only, since the fetch |
| 55 // of script content requires the info of associated render. | 56 // of script content requires the info of associated render. |
| 56 UserScriptRenderInfoMap script_render_info_map_; | 57 UserScriptRenderInfoMap script_render_info_map_; |
| 57 | 58 |
| 58 // The number of complete fetchs. | 59 // The number of complete fetchs. |
| 59 size_t complete_fetchers_; | 60 size_t complete_fetchers_; |
| 60 | 61 |
| 61 // Caches |user_scripts_| from UserScriptLoader when loading. | 62 // Caches |user_scripts_| from UserScriptLoader when loading. |
| 62 scoped_ptr<extensions::UserScriptList> user_scripts_cache_; | 63 scoped_ptr<extensions::UserScriptList> user_scripts_cache_; |
| 63 | 64 |
| 64 LoadScriptsCallback scripts_loaded_callback_; | 65 LoadScriptsCallback scripts_loaded_callback_; |
| 65 | 66 |
| 66 ScopedVector<WebUIURLFetcher> fetchers_; | 67 ScopedVector<WebUIURLFetcher> fetchers_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(WebUIUserScriptLoader); | 69 DISALLOW_COPY_AND_ASSIGN(WebUIUserScriptLoader); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 #endif // EXTENSIONS_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ | 72 #endif // EXTENSIONS_BROWSER_WEB_UI_USER_SCRIPT_LOADER_H_ |
| OLD | NEW |