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 show_dialog_callback_ = approval->show_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, extension_.get(), show_dialog_callback_); |
457 } else { | 459 } else { |
458 if (!BrowserThread::PostTask( | 460 if (!BrowserThread::PostTask( |
459 BrowserThread::FILE, FROM_HERE, | 461 BrowserThread::FILE, FROM_HERE, |
460 base::Bind(&CrxInstaller::CompleteInstall, this))) | 462 base::Bind(&CrxInstaller::CompleteInstall, this))) |
461 NOTREACHED(); | 463 NOTREACHED(); |
462 } | 464 } |
463 return; | 465 return; |
464 } | 466 } |
465 | 467 |
466 void CrxInstaller::InstallUIProceed() { | 468 void CrxInstaller::InstallUIProceed() { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // is problematic because they don't know anything about the | 652 // is problematic because they don't know anything about the |
651 // extension before it is unpacked, so they cannot filter based | 653 // extension before it is unpacked, so they cannot filter based |
652 // on the extension. | 654 // on the extension. |
653 content::NotificationService::current()->Notify( | 655 content::NotificationService::current()->Notify( |
654 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 656 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
655 content::Source<CrxInstaller>(this), | 657 content::Source<CrxInstaller>(this), |
656 content::Details<const Extension>(extension)); | 658 content::Details<const Extension>(extension)); |
657 } | 659 } |
658 | 660 |
659 } // namespace extensions | 661 } // namespace extensions |
OLD | NEW |