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

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

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 content::Source<Profile>(profile_)); 318 content::Source<Profile>(profile_));
319 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 319 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
320 content::Source<Profile>(profile_)); 320 content::Source<Profile>(profile_));
321 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 321 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
322 content::Source<Profile>(profile_)); 322 content::Source<Profile>(profile_));
323 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, 323 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
324 content::NotificationService::AllBrowserContextsAndSources()); 324 content::NotificationService::AllBrowserContextsAndSources());
325 } 325 }
326 326
327 UserScriptMaster::~UserScriptMaster() { 327 UserScriptMaster::~UserScriptMaster() {
328 if (script_reloader_) 328 if (script_reloader_.get())
329 script_reloader_->DisownMaster(); 329 script_reloader_->DisownMaster();
330 } 330 }
331 331
332 void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) { 332 void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) {
333 // Ensure handle is deleted or released. 333 // Ensure handle is deleted or released.
334 scoped_ptr<base::SharedMemory> handle_deleter(handle); 334 scoped_ptr<base::SharedMemory> handle_deleter(handle);
335 335
336 if (pending_load_) { 336 if (pending_load_) {
337 // While we were loading, there were further changes. Don't bother 337 // While we were loading, there were further changes. Don't bother
338 // notifying about these scripts and instead just immediately reload. 338 // notifying about these scripts and instead just immediately reload.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return; 410 return;
411 if (ScriptsReady()) 411 if (ScriptsReady())
412 SendUpdate(process, GetSharedMemory()); 412 SendUpdate(process, GetSharedMemory());
413 break; 413 break;
414 } 414 }
415 default: 415 default:
416 DCHECK(false); 416 DCHECK(false);
417 } 417 }
418 418
419 if (should_start_load) { 419 if (should_start_load) {
420 if (script_reloader_) { 420 if (script_reloader_.get()) {
421 pending_load_ = true; 421 pending_load_ = true;
422 } else { 422 } else {
423 StartLoad(); 423 StartLoad();
424 } 424 }
425 } 425 }
426 } 426 }
427 427
428 void UserScriptMaster::StartLoad() { 428 void UserScriptMaster::StartLoad() {
429 if (!script_reloader_) 429 if (!script_reloader_.get())
430 script_reloader_ = new ScriptReloader(this); 430 script_reloader_ = new ScriptReloader(this);
431 431
432 script_reloader_->StartLoad(user_scripts_, extensions_info_); 432 script_reloader_->StartLoad(user_scripts_, extensions_info_);
433 } 433 }
434 434
435 void UserScriptMaster::SendUpdate(content::RenderProcessHost* process, 435 void UserScriptMaster::SendUpdate(content::RenderProcessHost* process,
436 base::SharedMemory* shared_memory) { 436 base::SharedMemory* shared_memory) {
437 // Don't allow injection of content scripts into <webview>. 437 // Don't allow injection of content scripts into <webview>.
438 if (process->IsGuest()) 438 if (process->IsGuest())
439 return; 439 return;
(...skipping 11 matching lines...) Expand all
451 451
452 base::SharedMemoryHandle handle_for_process; 452 base::SharedMemoryHandle handle_for_process;
453 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 453 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
454 return; // This can legitimately fail if the renderer asserts at startup. 454 return; // This can legitimately fail if the renderer asserts at startup.
455 455
456 if (base::SharedMemory::IsHandleValid(handle_for_process)) 456 if (base::SharedMemory::IsHandleValid(handle_for_process))
457 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 457 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
458 } 458 }
459 459
460 } // namespace extensions 460 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | chrome/browser/extensions/web_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698