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/guest_view/web_view/web_view_content_script_manager
.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_content_script_manager
.h" |
6 | 6 |
7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "extensions/browser/declarative_user_script_manager.h" | 9 #include "extensions/browser/declarative_user_script_manager.h" |
10 #include "extensions/browser/declarative_user_script_master.h" | 10 #include "extensions/browser/declarative_user_script_master.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int embedder_process_id, | 42 int embedder_process_id, |
43 int embedder_routing_id, | 43 int embedder_routing_id, |
44 int view_instance_id, | 44 int view_instance_id, |
45 const HostID& host_id, | 45 const HostID& host_id, |
46 const std::map<std::string, UserScript>& scripts) { | 46 const std::map<std::string, UserScript>& scripts) { |
47 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 47 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
48 | 48 |
49 DeclarativeUserScriptMaster* master = | 49 DeclarativeUserScriptMaster* master = |
50 ExtensionSystem::Get(browser_context_) | 50 ExtensionSystem::Get(browser_context_) |
51 ->declarative_user_script_manager() | 51 ->declarative_user_script_manager() |
52 ->GetDeclarativeUserScriptMasterByID(host_id); | 52 ->GetDeclarativeUserScriptMasterByID(browser_context_, host_id); |
53 DCHECK(master); | 53 DCHECK(master); |
54 | 54 |
55 // We need to update WebViewRenderState in the IO thread if the guest exists. | 55 // We need to update WebViewRenderState in the IO thread if the guest exists. |
56 std::set<int> ids_to_add; | 56 std::set<int> ids_to_add; |
57 | 57 |
58 GuestMapKey key = std::pair<int, int>(embedder_process_id, view_instance_id); | 58 GuestMapKey key = std::pair<int, int>(embedder_process_id, view_instance_id); |
59 GuestContentScriptMap::iterator iter = guest_content_script_map_.find(key); | 59 GuestContentScriptMap::iterator iter = guest_content_script_map_.find(key); |
60 | 60 |
61 // If there isn't any content script added for the given guest yet, insert an | 61 // If there isn't any content script added for the given guest yet, insert an |
62 // empty map first. | 62 // empty map first. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (iter == guest_content_script_map_.end()) | 155 if (iter == guest_content_script_map_.end()) |
156 return ids; | 156 return ids; |
157 const ContentScriptMap& map = iter->second; | 157 const ContentScriptMap& map = iter->second; |
158 for (const auto& pair : map) | 158 for (const auto& pair : map) |
159 ids.insert(pair.second.id()); | 159 ids.insert(pair.second.id()); |
160 | 160 |
161 return ids; | 161 return ids; |
162 } | 162 } |
163 | 163 |
164 } // namespace extensions | 164 } // namespace extensions |
OLD | NEW |