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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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
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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 const content::NotificationSource& source, 343 const content::NotificationSource& source,
344 const content::NotificationDetails& details) { 344 const content::NotificationDetails& details) {
345 bool should_start_load = false; 345 bool should_start_load = false;
346 switch (type) { 346 switch (type) {
347 case chrome::NOTIFICATION_EXTENSIONS_READY: 347 case chrome::NOTIFICATION_EXTENSIONS_READY:
348 extensions_service_ready_ = true; 348 extensions_service_ready_ = true;
349 should_start_load = true; 349 should_start_load = true;
350 break; 350 break;
351 case chrome::NOTIFICATION_EXTENSION_LOADED: { 351 case chrome::NOTIFICATION_EXTENSION_LOADED: {
352 // Add any content scripts inside the extension. 352 // Add any content scripts inside the extension.
353 const Extension* extension = 353 const extensions::Extension* extension =
354 content::Details<const Extension>(details).ptr(); 354 content::Details<const extensions::Extension>(details).ptr();
355 extensions_info_[extension->id()] = 355 extensions_info_[extension->id()] =
356 ExtensionSet::ExtensionPathAndDefaultLocale( 356 ExtensionSet::ExtensionPathAndDefaultLocale(
357 extension->path(), extension->default_locale()); 357 extension->path(), extension->default_locale());
358 bool incognito_enabled = profile_->GetExtensionService()-> 358 bool incognito_enabled = profile_->GetExtensionService()->
359 IsIncognitoEnabled(extension->id()); 359 IsIncognitoEnabled(extension->id());
360 const UserScriptList& scripts = extension->content_scripts(); 360 const UserScriptList& scripts = extension->content_scripts();
361 for (UserScriptList::const_iterator iter = scripts.begin(); 361 for (UserScriptList::const_iterator iter = scripts.begin();
362 iter != scripts.end(); ++iter) { 362 iter != scripts.end(); ++iter) {
363 user_scripts_.push_back(*iter); 363 user_scripts_.push_back(*iter);
364 user_scripts_.back().set_incognito_enabled(incognito_enabled); 364 user_scripts_.back().set_incognito_enabled(incognito_enabled);
365 } 365 }
366 if (extensions_service_ready_) 366 if (extensions_service_ready_)
367 should_start_load = true; 367 should_start_load = true;
368 break; 368 break;
369 } 369 }
370 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 370 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
371 // Remove any content scripts. 371 // Remove any content scripts.
372 const Extension* extension = 372 const extensions::Extension* extension =
373 content::Details<UnloadedExtensionInfo>(details)->extension; 373 content::Details<extensions::UnloadedExtensionInfo>(
374 details)->extension;
374 extensions_info_.erase(extension->id()); 375 extensions_info_.erase(extension->id());
375 UserScriptList new_user_scripts; 376 UserScriptList new_user_scripts;
376 for (UserScriptList::iterator iter = user_scripts_.begin(); 377 for (UserScriptList::iterator iter = user_scripts_.begin();
377 iter != user_scripts_.end(); ++iter) { 378 iter != user_scripts_.end(); ++iter) {
378 if (iter->extension_id() != extension->id()) 379 if (iter->extension_id() != extension->id())
379 new_user_scripts.push_back(*iter); 380 new_user_scripts.push_back(*iter);
380 } 381 }
381 user_scripts_ = new_user_scripts; 382 user_scripts_ = new_user_scripts;
382 should_start_load = true; 383 should_start_load = true;
383 384
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (!handle) 431 if (!handle)
431 return; 432 return;
432 433
433 base::SharedMemoryHandle handle_for_process; 434 base::SharedMemoryHandle handle_for_process;
434 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 435 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
435 return; // This can legitimately fail if the renderer asserts at startup. 436 return; // This can legitimately fail if the renderer asserts at startup.
436 437
437 if (base::SharedMemory::IsHandleValid(handle_for_process)) 438 if (base::SharedMemory::IsHandleValid(handle_for_process))
438 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 439 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
439 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698