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

Side by Side Diff: extensions/browser/user_script_loader.cc

Issue 982113002: Fix a bug in UserScriptLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 9 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 | « no previous file | extensions/common/host_id.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/user_script_loader.h" 5 #include "extensions/browser/user_script_loader.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Pretend the extension change didn't happen. 440 // Pretend the extension change didn't happen.
441 return; 441 return;
442 } 442 }
443 443
444 // We've got scripts ready to go. 444 // We've got scripts ready to go.
445 shared_memory_.reset(shared_memory.release()); 445 shared_memory_.reset(shared_memory.release());
446 446
447 // If user scripts are coming from a <webview>, will only notify the 447 // If user scripts are coming from a <webview>, will only notify the
448 // RenderProcessHost of that <webview>; otherwise will notify all of the 448 // RenderProcessHost of that <webview>; otherwise will notify all of the
449 // RenderProcessHosts. 449 // RenderProcessHosts.
450 if (user_scripts && !user_scripts->empty() && 450 if (user_scripts_ && !user_scripts_->empty() &&
451 (*user_scripts)[0].consumer_instance_type() == 451 (*user_scripts_)[0].consumer_instance_type() ==
452 UserScript::ConsumerInstanceType::WEBVIEW) { 452 UserScript::ConsumerInstanceType::WEBVIEW) {
453 DCHECK_EQ(1u, user_scripts->size()); 453 DCHECK_EQ(1u, user_scripts_->size());
454 int render_process_id = (*user_scripts)[0].routing_info().render_process_id; 454 int render_process_id =
455 (*user_scripts_)[0].routing_info().render_process_id;
455 content::RenderProcessHost* host = 456 content::RenderProcessHost* host =
456 content::RenderProcessHost::FromID(render_process_id); 457 content::RenderProcessHost::FromID(render_process_id);
457 if (host) 458 if (host)
458 SendUpdate(host, shared_memory_.get(), changed_hosts_); 459 SendUpdate(host, shared_memory_.get(), changed_hosts_);
459 } else { 460 } else {
460 for (content::RenderProcessHost::iterator i( 461 for (content::RenderProcessHost::iterator i(
461 content::RenderProcessHost::AllHostsIterator()); 462 content::RenderProcessHost::AllHostsIterator());
462 !i.IsAtEnd(); i.Advance()) { 463 !i.IsAtEnd(); i.Advance()) {
463 SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_); 464 SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_);
464 } 465 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 for (const HostID& id : changed_hosts) 500 for (const HostID& id : changed_hosts)
500 changed_ids_set.insert(id.id()); 501 changed_ids_set.insert(id.id());
501 502
502 if (base::SharedMemory::IsHandleValid(handle_for_process)) { 503 if (base::SharedMemory::IsHandleValid(handle_for_process)) {
503 process->Send(new ExtensionMsg_UpdateUserScripts( 504 process->Send(new ExtensionMsg_UpdateUserScripts(
504 handle_for_process, host_id().id(), changed_ids_set)); 505 handle_for_process, host_id().id(), changed_ids_set));
505 } 506 }
506 } 507 }
507 508
508 } // namespace extensions 509 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/host_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698