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()) | |
lazyboy
2016/09/15 21:45:09
Should we also Reset |callback_|?
asargent_no_longer_on_chrome
2016/09/16 00:03:24
Good suggestion. Done.
| |
373 return; | |
374 | |
372 PermissionsUpdater perms_updater(service_weak_->profile()); | 375 PermissionsUpdater perms_updater(service_weak_->profile()); |
373 perms_updater.InitializePermissions(extension()); | 376 perms_updater.InitializePermissions(extension()); |
374 perms_updater.GrantActivePermissions(extension()); | 377 perms_updater.GrantActivePermissions(extension()); |
375 | 378 |
376 service_weak_->OnExtensionInstalled( | 379 service_weak_->OnExtensionInstalled( |
377 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 380 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
378 | 381 |
379 if (!callback_.is_null()) { | 382 if (!callback_.is_null()) { |
380 callback_.Run(extension(), extension_path_, std::string()); | 383 callback_.Run(extension(), extension_path_, std::string()); |
381 callback_.Reset(); | 384 callback_.Reset(); |
382 } | 385 } |
383 } | 386 } |
384 | 387 |
385 } // namespace extensions | 388 } // namespace extensions |
OLD | NEW |