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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 profile_(frontend_weak->profile()), | 79 profile_(frontend_weak->profile()), |
80 client_(client), | 80 client_(client), |
81 apps_require_extension_mime_type_(false), | 81 apps_require_extension_mime_type_(false), |
82 allow_silent_install_(false), | 82 allow_silent_install_(false), |
83 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 83 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
84 creation_flags_(Extension::NO_FLAGS) { | 84 creation_flags_(Extension::NO_FLAGS) { |
85 if (!approval) | 85 if (!approval) |
86 return; | 86 return; |
87 | 87 |
88 CHECK(profile_->IsSameProfile(approval->profile)); | 88 CHECK(profile_->IsSameProfile(approval->profile)); |
| 89 |
89 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble); | 90 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble); |
90 client_->set_skip_post_install_ui(approval->skip_post_install_ui); | 91 client_->set_skip_post_install_ui(approval->skip_post_install_ui); |
91 | 92 |
92 if (approval->skip_install_dialog) { | 93 // Mark the extension as approved, but save the expected manifest and ID |
93 // Mark the extension as approved, but save the expected manifest and ID | 94 // so we can check that they match the CRX's. |
94 // so we can check that they match the CRX's. | 95 approved_ = true; |
95 approved_ = true; | 96 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); |
96 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); | 97 expected_id_ = approval->extension_id; |
97 expected_id_ = approval->extension_id; | |
98 } | |
99 } | 98 } |
100 | 99 |
101 CrxInstaller::~CrxInstaller() { | 100 CrxInstaller::~CrxInstaller() { |
102 // Delete the temp directory and crx file as necessary. Note that the | 101 // Delete the temp directory and crx file as necessary. Note that the |
103 // destructor might be called on any thread, so we post a task to the file | 102 // destructor might be called on any thread, so we post a task to the file |
104 // thread to make sure the delete happens there. This is a best effort | 103 // thread to make sure the delete happens there. This is a best effort |
105 // operation since the browser can be shutting down so there might not | 104 // operation since the browser can be shutting down so there might not |
106 // be a file thread to post to. | 105 // be a file thread to post to. |
107 if (!temp_dir_.value().empty()) { | 106 if (!temp_dir_.value().empty()) { |
108 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 107 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // Some users (such as the download shelf) need to know when a | 549 // Some users (such as the download shelf) need to know when a |
551 // CRXInstaller is done. Listening for the EXTENSION_* events | 550 // CRXInstaller is done. Listening for the EXTENSION_* events |
552 // is problematic because they don't know anything about the | 551 // is problematic because they don't know anything about the |
553 // extension before it is unpacked, so they cannot filter based | 552 // extension before it is unpacked, so they cannot filter based |
554 // on the extension. | 553 // on the extension. |
555 content::NotificationService::current()->Notify( | 554 content::NotificationService::current()->Notify( |
556 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 555 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
557 content::Source<CrxInstaller>(this), | 556 content::Source<CrxInstaller>(this), |
558 content::Details<const Extension>(extension)); | 557 content::Details<const Extension>(extension)); |
559 } | 558 } |
OLD | NEW |