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()); |
154 | 156 |
155 if (!extension() || | 157 if (!extension() || |
156 !extension_l10n_util::ValidateExtensionLocales( | 158 !extension_l10n_util::ValidateExtensionLocales( |
157 extension_path_, extension()->manifest()->value(), &error)) { | 159 extension_path_, extension()->manifest()->value(), &error)) { |
158 ReportExtensionLoadError(error); | 160 ReportExtensionLoadError(error); |
159 return false; | 161 return false; |
160 } | 162 } |
161 | 163 |
162 ShowInstallPrompt(); | 164 ShowInstallPrompt(); |
163 | 165 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 error, | 305 error, |
304 service_weak_->profile(), | 306 service_weak_->profile(), |
305 be_noisy_on_failure_); | 307 be_noisy_on_failure_); |
306 } | 308 } |
307 } | 309 } |
308 | 310 |
309 void UnpackedInstaller::InstallExtension() { | 311 void UnpackedInstaller::InstallExtension() { |
310 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 312 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
311 | 313 |
312 PermissionsUpdater perms_updater(service_weak_->profile()); | 314 PermissionsUpdater perms_updater(service_weak_->profile()); |
| 315 perms_updater.InitializePermissions(extension()); |
313 perms_updater.GrantActivePermissions(extension()); | 316 perms_updater.GrantActivePermissions(extension()); |
314 | 317 |
315 service_weak_->OnExtensionInstalled( | 318 service_weak_->OnExtensionInstalled( |
316 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 319 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
317 } | 320 } |
318 | 321 |
319 } // namespace extensions | 322 } // namespace extensions |
OLD | NEW |