| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 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 "chrome/browser/extensions/user_script_master.h" |    5 #include "chrome/browser/extensions/user_script_master.h" | 
|    6  |    6  | 
|    7 #include <string> |    7 #include <string> | 
|    8 #include <vector> |    8 #include <vector> | 
|    9  |    9  | 
|   10 #include "base/file_path.h" |   10 #include "base/file_path.h" | 
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  355  |  355  | 
|  356 void UserScriptMaster::StartLoad() { |  356 void UserScriptMaster::StartLoad() { | 
|  357   if (!script_reloader_) |  357   if (!script_reloader_) | 
|  358     script_reloader_ = new ScriptReloader(this); |  358     script_reloader_ = new ScriptReloader(this); | 
|  359  |  359  | 
|  360   script_reloader_->StartLoad(user_scripts_); |  360   script_reloader_->StartLoad(user_scripts_); | 
|  361 } |  361 } | 
|  362  |  362  | 
|  363 void UserScriptMaster::SendUpdate(RenderProcessHost* process, |  363 void UserScriptMaster::SendUpdate(RenderProcessHost* process, | 
|  364                                   base::SharedMemory* shared_memory) { |  364                                   base::SharedMemory* shared_memory) { | 
 |  365   // Make sure we only send user scripts to processes in our profile. | 
 |  366   if (!profile_->IsSameProfile(process->profile())) | 
 |  367     return; | 
 |  368  | 
|  365   // If the process is being started asynchronously, early return.  We'll end up |  369   // If the process is being started asynchronously, early return.  We'll end up | 
|  366   // calling InitUserScripts when it's created which will call this again. |  370   // calling InitUserScripts when it's created which will call this again. | 
|  367   base::ProcessHandle handle = process->GetHandle(); |  371   base::ProcessHandle handle = process->GetHandle(); | 
|  368   if (!handle) |  372   if (!handle) | 
|  369     return; |  373     return; | 
|  370  |  374  | 
|  371   base::SharedMemoryHandle handle_for_process; |  375   base::SharedMemoryHandle handle_for_process; | 
|  372   if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |  376   if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 
|  373     return;  // This can legitimately fail if the renderer asserts at startup. |  377     return;  // This can legitimately fail if the renderer asserts at startup. | 
|  374  |  378  | 
|  375   if (base::SharedMemory::IsHandleValid(handle_for_process)) |  379   if (base::SharedMemory::IsHandleValid(handle_for_process)) | 
|  376     process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); |  380     process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); | 
|  377 } |  381 } | 
| OLD | NEW |