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

Side by Side Diff: chrome/browser/extensions/user_script_master.cc

Issue 7248008: Fix content script injection when multi-profiles are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the early return to the top of SendUpdate. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_io_data.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 (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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698