| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 void CrxInstaller::ReportSuccessFromUIThread() { | 539 void CrxInstaller::ReportSuccessFromUIThread() { |
| 540 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 540 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 541 | 541 |
| 542 if (!frontend_weak_.get()) | 542 if (!frontend_weak_.get()) |
| 543 return; | 543 return; |
| 544 | 544 |
| 545 // If there is a client, tell the client about installation. | 545 // If there is a client, tell the client about installation. |
| 546 if (client_) | 546 if (client_) |
| 547 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); | 547 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); |
| 548 | 548 |
| 549 // We update the extension's granted permissions if the user already approved |
| 550 // the install (client_ is non NULL), or we are allowed to install this |
| 551 // silently. We only track granted permissions for INTERNAL extensions. |
| 552 if ((client_ || allow_silent_install_) && |
| 553 extension_->location() == Extension::INTERNAL) |
| 554 frontend_weak_->GrantPermissions(extension_); |
| 555 |
| 549 // Tell the frontend about the installation and hand off ownership of | 556 // Tell the frontend about the installation and hand off ownership of |
| 550 // extension_ to it. | 557 // extension_ to it. |
| 551 frontend_weak_->OnExtensionInstalled(extension_); | 558 frontend_weak_->OnExtensionInstalled(extension_); |
| 552 extension_ = NULL; | 559 extension_ = NULL; |
| 553 | 560 |
| 554 NotifyCrxInstallComplete(); | 561 NotifyCrxInstallComplete(); |
| 555 | 562 |
| 556 // We're done. We don't post any more tasks to ourselves so we are deleted | 563 // We're done. We don't post any more tasks to ourselves so we are deleted |
| 557 // soon. | 564 // soon. |
| 558 } | 565 } |
| 559 | 566 |
| 560 void CrxInstaller::NotifyCrxInstallComplete() { | 567 void CrxInstaller::NotifyCrxInstallComplete() { |
| 561 // Some users (such as the download shelf) need to know when a | 568 // Some users (such as the download shelf) need to know when a |
| 562 // CRXInstaller is done. Listening for the EXTENSION_* events | 569 // CRXInstaller is done. Listening for the EXTENSION_* events |
| 563 // is problematic because they don't know anything about the | 570 // is problematic because they don't know anything about the |
| 564 // extension before it is unpacked, so they can not filter based | 571 // extension before it is unpacked, so they can not filter based |
| 565 // on the extension. | 572 // on the extension. |
| 566 NotificationService::current()->Notify( | 573 NotificationService::current()->Notify( |
| 567 NotificationType::CRX_INSTALLER_DONE, | 574 NotificationType::CRX_INSTALLER_DONE, |
| 568 Source<CrxInstaller>(this), | 575 Source<CrxInstaller>(this), |
| 569 NotificationService::NoDetails()); | 576 NotificationService::NoDetails()); |
| 570 } | 577 } |
| OLD | NEW |