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

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

Issue 2348633002: Make sure to to check weak ptr validity before use in UnpackedInstaller (Closed)
Patch Set: reset callback Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 if (!callback_.is_null()) { 363 if (!callback_.is_null()) {
364 callback_.Run(nullptr, extension_path_, error); 364 callback_.Run(nullptr, extension_path_, error);
365 callback_.Reset(); 365 callback_.Reset();
366 } 366 }
367 } 367 }
368 368
369 void UnpackedInstaller::InstallExtension() { 369 void UnpackedInstaller::InstallExtension() {
370 DCHECK_CURRENTLY_ON(BrowserThread::UI); 370 DCHECK_CURRENTLY_ON(BrowserThread::UI);
371 371
372 if (!service_weak_.get()) {
373 callback_.Reset();
374 return;
375 }
376
372 PermissionsUpdater perms_updater(service_weak_->profile()); 377 PermissionsUpdater perms_updater(service_weak_->profile());
373 perms_updater.InitializePermissions(extension()); 378 perms_updater.InitializePermissions(extension());
374 perms_updater.GrantActivePermissions(extension()); 379 perms_updater.GrantActivePermissions(extension());
375 380
376 service_weak_->OnExtensionInstalled( 381 service_weak_->OnExtensionInstalled(
377 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); 382 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately);
378 383
379 if (!callback_.is_null()) { 384 if (!callback_.is_null()) {
380 callback_.Run(extension(), extension_path_, std::string()); 385 callback_.Run(extension(), extension_path_, std::string());
381 callback_.Reset(); 386 callback_.Reset();
382 } 387 }
383 } 388 }
384 389
385 } // namespace extensions 390 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698