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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 allow_silent_install_(false), | 125 allow_silent_install_(false), |
126 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 126 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
127 creation_flags_(Extension::NO_FLAGS), | 127 creation_flags_(Extension::NO_FLAGS), |
128 off_store_install_allow_reason_(OffStoreInstallDisallowed), | 128 off_store_install_allow_reason_(OffStoreInstallDisallowed), |
129 did_handle_successfully_(true), | 129 did_handle_successfully_(true), |
130 error_on_unsupported_requirements_(false), | 130 error_on_unsupported_requirements_(false), |
131 has_requirement_errors_(false), | 131 has_requirement_errors_(false), |
132 blacklist_state_(extensions::NOT_BLACKLISTED), | 132 blacklist_state_(extensions::NOT_BLACKLISTED), |
133 install_wait_for_idle_(true), | 133 install_wait_for_idle_(true), |
134 update_from_settings_page_(false), | 134 update_from_settings_page_(false), |
| 135 is_ephemeral_(false), |
135 installer_(service_weak->profile()) { | 136 installer_(service_weak->profile()) { |
136 installer_task_runner_ = service_weak->GetFileTaskRunner(); | 137 installer_task_runner_ = service_weak->GetFileTaskRunner(); |
137 if (!approval) | 138 if (!approval) |
138 return; | 139 return; |
139 | 140 |
140 CHECK(profile()->IsSameProfile(approval->profile)); | 141 CHECK(profile()->IsSameProfile(approval->profile)); |
141 if (client_) { | 142 if (client_) { |
142 client_->install_ui()->SetUseAppInstalledBubble( | 143 client_->install_ui()->SetUseAppInstalledBubble( |
143 approval->use_app_installed_bubble); | 144 approval->use_app_installed_bubble); |
144 client_->install_ui()->set_skip_post_install_ui( | 145 client_->install_ui()->set_skip_post_install_ui( |
145 approval->skip_post_install_ui); | 146 approval->skip_post_install_ui); |
146 } | 147 } |
147 | 148 |
148 if (approval->skip_install_dialog) { | 149 if (approval->skip_install_dialog) { |
149 // Mark the extension as approved, but save the expected manifest and ID | 150 // Mark the extension as approved, but save the expected manifest and ID |
150 // so we can check that they match the CRX's. | 151 // so we can check that they match the CRX's. |
151 approved_ = true; | 152 approved_ = true; |
152 expected_manifest_check_level_ = approval->manifest_check_level; | 153 expected_manifest_check_level_ = approval->manifest_check_level; |
153 if (expected_manifest_check_level_ != | 154 if (expected_manifest_check_level_ != |
154 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) | 155 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) |
155 expected_manifest_.reset(approval->manifest->DeepCopy()); | 156 expected_manifest_.reset(approval->manifest->DeepCopy()); |
156 expected_id_ = approval->extension_id; | 157 expected_id_ = approval->extension_id; |
157 } | 158 } |
158 if (approval->minimum_version.get()) { | 159 if (approval->minimum_version.get()) { |
159 expected_version_.reset(new Version(*approval->minimum_version)); | 160 expected_version_.reset(new Version(*approval->minimum_version)); |
160 expected_version_strict_checking_ = false; | 161 expected_version_strict_checking_ = false; |
161 } | 162 } |
162 | 163 |
163 show_dialog_callback_ = approval->show_dialog_callback; | 164 show_dialog_callback_ = approval->show_dialog_callback; |
164 | 165 is_ephemeral_ = approval->is_ephemeral; |
165 if (approval->is_ephemeral) | |
166 creation_flags_ |= Extension::IS_EPHEMERAL; | |
167 } | 166 } |
168 | 167 |
169 CrxInstaller::~CrxInstaller() { | 168 CrxInstaller::~CrxInstaller() { |
170 // Make sure the UI is deleted on the ui thread. | 169 // Make sure the UI is deleted on the ui thread. |
171 if (client_) { | 170 if (client_) { |
172 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | 171 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); |
173 client_ = NULL; | 172 client_ = NULL; |
174 } | 173 } |
175 } | 174 } |
176 | 175 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 if (client_ || allow_silent_install_) { | 804 if (client_ || allow_silent_install_) { |
806 PermissionsUpdater perms_updater(profile()); | 805 PermissionsUpdater perms_updater(profile()); |
807 perms_updater.GrantActivePermissions(extension()); | 806 perms_updater.GrantActivePermissions(extension()); |
808 } | 807 } |
809 } | 808 } |
810 | 809 |
811 service_weak_->OnExtensionInstalled(extension(), | 810 service_weak_->OnExtensionInstalled(extension(), |
812 page_ordinal_, | 811 page_ordinal_, |
813 has_requirement_errors_, | 812 has_requirement_errors_, |
814 blacklist_state_, | 813 blacklist_state_, |
| 814 is_ephemeral_, |
815 install_wait_for_idle_); | 815 install_wait_for_idle_); |
816 NotifyCrxInstallComplete(true); | 816 NotifyCrxInstallComplete(true); |
817 } | 817 } |
818 | 818 |
819 void CrxInstaller::NotifyCrxInstallBegin() { | 819 void CrxInstaller::NotifyCrxInstallBegin() { |
820 InstallTrackerFactory::GetForProfile(profile()) | 820 InstallTrackerFactory::GetForProfile(profile()) |
821 ->OnBeginCrxInstall(expected_id_); | 821 ->OnBeginCrxInstall(expected_id_); |
822 } | 822 } |
823 | 823 |
824 void CrxInstaller::NotifyCrxInstallComplete(bool success) { | 824 void CrxInstaller::NotifyCrxInstallComplete(bool success) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 897 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
898 return; | 898 return; |
899 | 899 |
900 if (client_) { | 900 if (client_) { |
901 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 901 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
902 client_->ConfirmReEnable(this, extension()); | 902 client_->ConfirmReEnable(this, extension()); |
903 } | 903 } |
904 } | 904 } |
905 | 905 |
906 } // namespace extensions | 906 } // namespace extensions |
OLD | NEW |