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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 &ScriptReloader::NotifyMaster, this, Serialize(user_scripts))); 315 &ScriptReloader::NotifyMaster, this, Serialize(user_scripts)));
316 } 316 }
317 317
318 318
319 UserScriptMaster::UserScriptMaster(Profile* profile) 319 UserScriptMaster::UserScriptMaster(Profile* profile)
320 : extensions_service_ready_(false), 320 : extensions_service_ready_(false),
321 pending_load_(false), 321 pending_load_(false),
322 profile_(profile) { 322 profile_(profile) {
323 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 323 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
324 content::Source<Profile>(profile_)); 324 content::Source<Profile>(profile_));
325 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 325 registrar_.Add(this,
326 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
326 content::Source<Profile>(profile_)); 327 content::Source<Profile>(profile_));
327 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 328 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
328 content::Source<Profile>(profile_)); 329 content::Source<Profile>(profile_));
329 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, 330 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
330 content::NotificationService::AllBrowserContextsAndSources()); 331 content::NotificationService::AllBrowserContextsAndSources());
331 } 332 }
332 333
333 UserScriptMaster::~UserScriptMaster() { 334 UserScriptMaster::~UserScriptMaster() {
334 if (script_reloader_.get()) 335 if (script_reloader_.get())
335 script_reloader_->DisownMaster(); 336 script_reloader_->DisownMaster();
(...skipping 29 matching lines...) Expand all
365 366
366 void UserScriptMaster::Observe(int type, 367 void UserScriptMaster::Observe(int type,
367 const content::NotificationSource& source, 368 const content::NotificationSource& source,
368 const content::NotificationDetails& details) { 369 const content::NotificationDetails& details) {
369 bool should_start_load = false; 370 bool should_start_load = false;
370 switch (type) { 371 switch (type) {
371 case chrome::NOTIFICATION_EXTENSIONS_READY: 372 case chrome::NOTIFICATION_EXTENSIONS_READY:
372 extensions_service_ready_ = true; 373 extensions_service_ready_ = true;
373 should_start_load = true; 374 should_start_load = true;
374 break; 375 break;
375 case chrome::NOTIFICATION_EXTENSION_LOADED: { 376 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
376 // Add any content scripts inside the extension. 377 // Add any content scripts inside the extension.
377 const Extension* extension = 378 const Extension* extension =
378 content::Details<const Extension>(details).ptr(); 379 content::Details<const Extension>(details).ptr();
379 extensions_info_[extension->id()] = 380 extensions_info_[extension->id()] =
380 ExtensionSet::ExtensionPathAndDefaultLocale( 381 ExtensionSet::ExtensionPathAndDefaultLocale(
381 extension->path(), LocaleInfo::GetDefaultLocale(extension)); 382 extension->path(), LocaleInfo::GetDefaultLocale(extension));
382 bool incognito_enabled = 383 bool incognito_enabled =
383 util::IsIncognitoEnabled(extension->id(), profile_); 384 util::IsIncognitoEnabled(extension->id(), profile_);
384 const UserScriptList& scripts = 385 const UserScriptList& scripts =
385 ContentScriptsInfo::GetContentScripts(extension); 386 ContentScriptsInfo::GetContentScripts(extension);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 458
458 base::SharedMemoryHandle handle_for_process; 459 base::SharedMemoryHandle handle_for_process;
459 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 460 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
460 return; // This can legitimately fail if the renderer asserts at startup. 461 return; // This can legitimately fail if the renderer asserts at startup.
461 462
462 if (base::SharedMemory::IsHandleValid(handle_for_process)) 463 if (base::SharedMemory::IsHandleValid(handle_for_process))
463 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 464 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
464 } 465 }
465 466
466 } // namespace extensions 467 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/user_script_listener_unittest.cc ('k') | chrome/browser/infobars/infobars_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698