OLD | NEW |
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 Loading... |
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 |
OLD | NEW |