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

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

Issue 11882035: Stop sending events and messages to content script contexts after their (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/renderer/extensions/chrome_v8_context_set.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 content::Details<UnloadedExtensionInfo>(details)->extension; 378 content::Details<UnloadedExtensionInfo>(details)->extension;
379 extensions_info_.erase(extension->id()); 379 extensions_info_.erase(extension->id());
380 UserScriptList new_user_scripts; 380 UserScriptList new_user_scripts;
381 for (UserScriptList::iterator iter = user_scripts_.begin(); 381 for (UserScriptList::iterator iter = user_scripts_.begin();
382 iter != user_scripts_.end(); ++iter) { 382 iter != user_scripts_.end(); ++iter) {
383 if (iter->extension_id() != extension->id()) 383 if (iter->extension_id() != extension->id())
384 new_user_scripts.push_back(*iter); 384 new_user_scripts.push_back(*iter);
385 } 385 }
386 user_scripts_ = new_user_scripts; 386 user_scripts_ = new_user_scripts;
387 should_start_load = true; 387 should_start_load = true;
388
389 // TODO(aa): Do we want to do something smarter for the scripts that have
390 // already been injected?
391
392 break; 388 break;
393 } 389 }
394 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 390 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
395 content::RenderProcessHost* process = 391 content::RenderProcessHost* process =
396 content::Source<content::RenderProcessHost>(source).ptr(); 392 content::Source<content::RenderProcessHost>(source).ptr();
397 Profile* profile = Profile::FromBrowserContext( 393 Profile* profile = Profile::FromBrowserContext(
398 process->GetBrowserContext()); 394 process->GetBrowserContext());
399 if (!profile_->IsSameProfile(profile)) 395 if (!profile_->IsSameProfile(profile))
400 return; 396 return;
401 if (ScriptsReady()) 397 if (ScriptsReady())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 433
438 base::SharedMemoryHandle handle_for_process; 434 base::SharedMemoryHandle handle_for_process;
439 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 435 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
440 return; // This can legitimately fail if the renderer asserts at startup. 436 return; // This can legitimately fail if the renderer asserts at startup.
441 437
442 if (base::SharedMemory::IsHandleValid(handle_for_process)) 438 if (base::SharedMemory::IsHandleValid(handle_for_process))
443 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 439 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
444 } 440 }
445 441
446 } // namespace extensions 442 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/chrome_v8_context_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698