Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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() && |
|
Devlin
2015/03/05 20:18:38
D'oh.
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |