Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_content_script_manager.cc

Issue 1056133005: Make WebUI webview content script work with incognito. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview-content-script-api-from-xi
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/declarative_user_script_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/browser/declarative_user_script_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698