OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/unpacked_installer.h" | 5 #include "chrome/browser/extensions/unpacked_installer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 if (!IsLoadingUnpackedAllowed()) { | 145 if (!IsLoadingUnpackedAllowed()) { |
146 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError); | 146 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError); |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
150 std::string error; | 150 std::string error; |
151 install_checker_.set_extension( | 151 install_checker_.set_extension( |
152 file_util::LoadExtension( | 152 file_util::LoadExtension( |
153 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get()); | 153 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get()); |
154 PermissionsUpdater(service_weak_->profile()) | |
155 .InitializePermissions(extension()); | |
156 | 154 |
157 if (!extension() || | 155 if (!extension() || |
158 !extension_l10n_util::ValidateExtensionLocales( | 156 !extension_l10n_util::ValidateExtensionLocales( |
159 extension_path_, extension()->manifest()->value(), &error)) { | 157 extension_path_, extension()->manifest()->value(), &error)) { |
160 ReportExtensionLoadError(error); | 158 ReportExtensionLoadError(error); |
161 return false; | 159 return false; |
162 } | 160 } |
163 | 161 |
| 162 PermissionsUpdater( |
| 163 service_weak_->profile(), PermissionsUpdater::INIT_FLAG_TRANSIENT) |
| 164 .InitializePermissions(extension()); |
164 ShowInstallPrompt(); | 165 ShowInstallPrompt(); |
165 | 166 |
166 *extension_id = extension()->id(); | 167 *extension_id = extension()->id(); |
167 return true; | 168 return true; |
168 } | 169 } |
169 | 170 |
170 void UnpackedInstaller::ShowInstallPrompt() { | 171 void UnpackedInstaller::ShowInstallPrompt() { |
171 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 172 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
172 if (!service_weak_.get()) | 173 if (!service_weak_.get()) |
173 return; | 174 return; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 314 |
314 PermissionsUpdater perms_updater(service_weak_->profile()); | 315 PermissionsUpdater perms_updater(service_weak_->profile()); |
315 perms_updater.InitializePermissions(extension()); | 316 perms_updater.InitializePermissions(extension()); |
316 perms_updater.GrantActivePermissions(extension()); | 317 perms_updater.GrantActivePermissions(extension()); |
317 | 318 |
318 service_weak_->OnExtensionInstalled( | 319 service_weak_->OnExtensionInstalled( |
319 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 320 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
320 } | 321 } |
321 | 322 |
322 } // namespace extensions | 323 } // namespace extensions |
OLD | NEW |