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

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

Issue 7480028: Removal of Profile from content part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 void UserScriptMaster::StartLoad() { 357 void UserScriptMaster::StartLoad() {
358 if (!script_reloader_) 358 if (!script_reloader_)
359 script_reloader_ = new ScriptReloader(this); 359 script_reloader_ = new ScriptReloader(this);
360 360
361 script_reloader_->StartLoad(user_scripts_); 361 script_reloader_->StartLoad(user_scripts_);
362 } 362 }
363 363
364 void UserScriptMaster::SendUpdate(RenderProcessHost* process, 364 void UserScriptMaster::SendUpdate(RenderProcessHost* process,
365 base::SharedMemory* shared_memory) { 365 base::SharedMemory* shared_memory) {
366 Profile* profile = Profile::FromBrowserContext(process->browser_context());
366 // Make sure we only send user scripts to processes in our profile. 367 // Make sure we only send user scripts to processes in our profile.
367 if (!profile_->IsSameProfile(process->profile())) 368 if (!profile_->IsSameProfile(profile))
368 return; 369 return;
369 370
370 // If the process is being started asynchronously, early return. We'll end up 371 // If the process is being started asynchronously, early return. We'll end up
371 // calling InitUserScripts when it's created which will call this again. 372 // calling InitUserScripts when it's created which will call this again.
372 base::ProcessHandle handle = process->GetHandle(); 373 base::ProcessHandle handle = process->GetHandle();
373 if (!handle) 374 if (!handle)
374 return; 375 return;
375 376
376 base::SharedMemoryHandle handle_for_process; 377 base::SharedMemoryHandle handle_for_process;
377 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 378 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
378 return; // This can legitimately fail if the renderer asserts at startup. 379 return; // This can legitimately fail if the renderer asserts at startup.
379 380
380 if (base::SharedMemory::IsHandleValid(handle_for_process)) 381 if (base::SharedMemory::IsHandleValid(handle_for_process))
381 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 382 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
382 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698