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