| 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 #include "extensions/browser/web_ui_user_script_loader.h" | 5 #include "extensions/browser/web_ui_user_script_loader.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 content::BrowserContext* browser_context, | 41 content::BrowserContext* browser_context, |
| 42 const HostID& host_id) | 42 const HostID& host_id) |
| 43 : UserScriptLoader(browser_context, host_id), complete_fetchers_(0) { | 43 : UserScriptLoader(browser_context, host_id), complete_fetchers_(0) { |
| 44 SetReady(true); | 44 SetReady(true); |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebUIUserScriptLoader::~WebUIUserScriptLoader() { | 47 WebUIUserScriptLoader::~WebUIUserScriptLoader() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void WebUIUserScriptLoader::AddScripts( | 50 void WebUIUserScriptLoader::AddScripts( |
| 51 const std::set<extensions::UserScript>& scripts, | 51 const extensions::UserScriptList& scripts, |
| 52 int render_process_id, | 52 int render_process_id, |
| 53 int render_view_id) { | 53 int render_view_id) { |
| 54 UserScriptRenderInfo info(render_process_id, render_view_id); | 54 UserScriptRenderInfo info(render_process_id, render_view_id); |
| 55 for (const extensions::UserScript& script : scripts) { | 55 for (const extensions::UserScript& script : scripts) { |
| 56 script_render_info_map_.insert( | 56 script_render_info_map_.insert( |
| 57 std::pair<int, UserScriptRenderInfo>(script.id(), info)); | 57 std::pair<int, UserScriptRenderInfo>(script.id(), info)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 extensions::UserScriptLoader::AddScripts(scripts); | 60 extensions::UserScriptLoader::AddScripts(scripts); |
| 61 } | 61 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 void WebUIUserScriptLoader::OnWebUIURLFetchComplete() { | 148 void WebUIUserScriptLoader::OnWebUIURLFetchComplete() { |
| 149 content::BrowserThread::PostTask( | 149 content::BrowserThread::PostTask( |
| 150 content::BrowserThread::FILE, FROM_HERE, | 150 content::BrowserThread::FILE, FROM_HERE, |
| 151 base::Bind(&SerializeOnFileThread, base::Passed(&user_scripts_cache_), | 151 base::Bind(&SerializeOnFileThread, base::Passed(&user_scripts_cache_), |
| 152 scripts_loaded_callback_)); | 152 scripts_loaded_callback_)); |
| 153 scripts_loaded_callback_.Reset(); | 153 scripts_loaded_callback_.Reset(); |
| 154 } | 154 } |
| OLD | NEW |