| OLD | NEW |
| 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/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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (approval->skip_install_dialog) { | 119 if (approval->skip_install_dialog) { |
| 120 // Mark the extension as approved, but save the expected manifest and ID | 120 // Mark the extension as approved, but save the expected manifest and ID |
| 121 // so we can check that they match the CRX's. | 121 // so we can check that they match the CRX's. |
| 122 approved_ = true; | 122 approved_ = true; |
| 123 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); | 123 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); |
| 124 expected_id_ = approval->extension_id; | 124 expected_id_ = approval->extension_id; |
| 125 record_oauth2_grant_ = approval->record_oauth2_grant; | 125 record_oauth2_grant_ = approval->record_oauth2_grant; |
| 126 } | 126 } |
| 127 |
| 128 custom_install_dialog_callback_ = approval->custom_install_dialog_callback; |
| 127 } | 129 } |
| 128 | 130 |
| 129 CrxInstaller::~CrxInstaller() { | 131 CrxInstaller::~CrxInstaller() { |
| 130 // Delete the temp directory and crx file as necessary. Note that the | 132 // Delete the temp directory and crx file as necessary. Note that the |
| 131 // destructor might be called on any thread, so we post a task to the file | 133 // destructor might be called on any thread, so we post a task to the file |
| 132 // thread to make sure the delete happens there. This is a best effort | 134 // thread to make sure the delete happens there. This is a best effort |
| 133 // operation since the browser can be shutting down so there might not | 135 // operation since the browser can be shutting down so there might not |
| 134 // be a file thread to post to. | 136 // be a file thread to post to. |
| 135 if (!temp_dir_.value().empty()) { | 137 if (!temp_dir_.value().empty()) { |
| 136 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 138 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 IDS_EXTENSION_OVERLAPPING_WEB_EXTENT, | 448 IDS_EXTENSION_OVERLAPPING_WEB_EXTENT, |
| 447 UTF8ToUTF16(overlapping_extension->name())))); | 449 UTF8ToUTF16(overlapping_extension->name())))); |
| 448 return; | 450 return; |
| 449 } | 451 } |
| 450 | 452 |
| 451 current_version_ = | 453 current_version_ = |
| 452 frontend_weak_->extension_prefs()->GetVersionString(extension_->id()); | 454 frontend_weak_->extension_prefs()->GetVersionString(extension_->id()); |
| 453 | 455 |
| 454 if (client_ && (!allow_silent_install_ || !approved_)) { | 456 if (client_ && (!allow_silent_install_ || !approved_)) { |
| 455 AddRef(); // Balanced in Proceed() and Abort(). | 457 AddRef(); // Balanced in Proceed() and Abort(). |
| 456 client_->ConfirmInstall(this, extension_.get()); | 458 client_->ConfirmInstall(this, |
| 459 extension_.get(), |
| 460 custom_install_dialog_callback_); |
| 457 } else { | 461 } else { |
| 458 if (!BrowserThread::PostTask( | 462 if (!BrowserThread::PostTask( |
| 459 BrowserThread::FILE, FROM_HERE, | 463 BrowserThread::FILE, FROM_HERE, |
| 460 base::Bind(&CrxInstaller::CompleteInstall, this))) | 464 base::Bind(&CrxInstaller::CompleteInstall, this))) |
| 461 NOTREACHED(); | 465 NOTREACHED(); |
| 462 } | 466 } |
| 463 return; | 467 return; |
| 464 } | 468 } |
| 465 | 469 |
| 466 void CrxInstaller::InstallUIProceed() { | 470 void CrxInstaller::InstallUIProceed() { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 // is problematic because they don't know anything about the | 655 // is problematic because they don't know anything about the |
| 652 // extension before it is unpacked, so they cannot filter based | 656 // extension before it is unpacked, so they cannot filter based |
| 653 // on the extension. | 657 // on the extension. |
| 654 content::NotificationService::current()->Notify( | 658 content::NotificationService::current()->Notify( |
| 655 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 659 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 656 content::Source<CrxInstaller>(this), | 660 content::Source<CrxInstaller>(this), |
| 657 content::Details<const Extension>(extension)); | 661 content::Details<const Extension>(extension)); |
| 658 } | 662 } |
| 659 | 663 |
| 660 } // namespace extensions | 664 } // namespace extensions |
| OLD | NEW |