OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 // The unpack dir we don't have to delete explicity since it is a child of | 135 // The unpack dir we don't have to delete explicity since it is a child of |
136 // the temp dir. | 136 // the temp dir. |
137 unpacked_extension_root_ = extension_dir; | 137 unpacked_extension_root_ = extension_dir; |
138 | 138 |
139 // Only allow extensions with a gallery update url to be installed after | 139 // Only allow extensions with a gallery update url to be installed after |
140 // having been directly downloaded from the gallery. | 140 // having been directly downloaded from the gallery. |
141 if (extension->update_url() == GURL(extension_urls::kGalleryUpdateURL) && | 141 if (extension->update_url() == GURL(extension_urls::kGalleryUpdateURL) && |
142 !StartsWithASCII(original_url_.spec(), | 142 !StartsWithASCII(original_url_.spec(), |
143 extension_urls::kGalleryDownloadPrefix, false)) { | 143 extension_urls::kGalleryDownloadPrefix, false)) { |
144 ReportFailureFromUIThread(l10n_util::GetStringFUTF8( | 144 ReportFailureFromFileThread(l10n_util::GetStringFUTF8( |
145 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, | 145 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, |
146 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); | 146 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); |
147 return; | 147 return; |
148 } | 148 } |
149 | 149 |
150 // Determine whether to allow installation. We always allow themes and | 150 // Determine whether to allow installation. We always allow themes and |
151 // external installs. | 151 // external installs. |
152 if (!extensions_enabled_ && !extension->is_theme() && | 152 if (!extensions_enabled_ && !extension->is_theme() && |
153 !Extension::IsExternalLocation(install_source_)) { | 153 !Extension::IsExternalLocation(install_source_)) { |
154 ReportFailureFromFileThread("Extensions are not enabled."); | 154 ReportFailureFromFileThread("Extensions are not enabled."); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 client_->OnInstallSuccess(extension_.get()); | 333 client_->OnInstallSuccess(extension_.get()); |
334 | 334 |
335 // Tell the frontend about the installation and hand off ownership of | 335 // Tell the frontend about the installation and hand off ownership of |
336 // extension_ to it. | 336 // extension_ to it. |
337 frontend_->OnExtensionInstalled(extension_.release(), | 337 frontend_->OnExtensionInstalled(extension_.release(), |
338 allow_privilege_increase_); | 338 allow_privilege_increase_); |
339 | 339 |
340 // We're done. We don't post any more tasks to ourselves so we are deleted | 340 // We're done. We don't post any more tasks to ourselves so we are deleted |
341 // soon. | 341 // soon. |
342 } | 342 } |
OLD | NEW |