| 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 11 matching lines...) Expand all Loading... |
| 22 #include "extensions/browser/extension_dialog_auto_confirm.h" | 22 #include "extensions/browser/extension_dialog_auto_confirm.h" |
| 23 #include "extensions/browser/extension_prefs.h" | 23 #include "extensions/browser/extension_prefs.h" |
| 24 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
| 25 #include "extensions/browser/install/extension_install_ui.h" | 25 #include "extensions/browser/install/extension_install_ui.h" |
| 26 #include "extensions/browser/install_flag.h" | 26 #include "extensions/browser/install_flag.h" |
| 27 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
| 28 #include "extensions/common/extension_l10n_util.h" | 28 #include "extensions/common/extension_l10n_util.h" |
| 29 #include "extensions/common/file_util.h" | 29 #include "extensions/common/file_util.h" |
| 30 #include "extensions/common/manifest.h" | 30 #include "extensions/common/manifest.h" |
| 31 #include "extensions/common/manifest_handlers/shared_module_info.h" | 31 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 32 #include "extensions/common/permissions/permissions_data.h" |
| 32 #include "sync/api/string_ordinal.h" | 33 #include "sync/api/string_ordinal.h" |
| 33 | 34 |
| 34 using content::BrowserThread; | 35 using content::BrowserThread; |
| 35 using extensions::Extension; | 36 using extensions::Extension; |
| 36 using extensions::SharedModuleInfo; | 37 using extensions::SharedModuleInfo; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 const char kUnpackedExtensionsBlacklistedError[] = | 41 const char kUnpackedExtensionsBlacklistedError[] = |
| 41 "Loading of unpacked extensions is disabled by the administrator."; | 42 "Loading of unpacked extensions is disabled by the administrator."; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 file_util::LoadExtension( | 162 file_util::LoadExtension( |
| 162 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get()); | 163 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get()); |
| 163 | 164 |
| 164 if (!extension() || | 165 if (!extension() || |
| 165 !extension_l10n_util::ValidateExtensionLocales( | 166 !extension_l10n_util::ValidateExtensionLocales( |
| 166 extension_path_, extension()->manifest()->value(), &error)) { | 167 extension_path_, extension()->manifest()->value(), &error)) { |
| 167 ReportExtensionLoadError(error); | 168 ReportExtensionLoadError(error); |
| 168 return false; | 169 return false; |
| 169 } | 170 } |
| 170 | 171 |
| 172 extension()->permissions_data()->BindToCurrentThread(); |
| 171 PermissionsUpdater( | 173 PermissionsUpdater( |
| 172 service_weak_->profile(), PermissionsUpdater::INIT_FLAG_TRANSIENT) | 174 service_weak_->profile(), PermissionsUpdater::INIT_FLAG_TRANSIENT) |
| 173 .InitializePermissions(extension()); | 175 .InitializePermissions(extension()); |
| 174 ShowInstallPrompt(); | 176 ShowInstallPrompt(); |
| 175 | 177 |
| 176 *extension_id = extension()->id(); | 178 *extension_id = extension()->id(); |
| 177 return true; | 179 return true; |
| 178 } | 180 } |
| 179 | 181 |
| 180 void UnpackedInstaller::ShowInstallPrompt() { | 182 void UnpackedInstaller::ShowInstallPrompt() { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 service_weak_->OnExtensionInstalled( | 371 service_weak_->OnExtensionInstalled( |
| 370 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 372 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
| 371 | 373 |
| 372 if (!callback_.is_null()) { | 374 if (!callback_.is_null()) { |
| 373 callback_.Run(extension(), extension_path_, std::string()); | 375 callback_.Run(extension(), extension_path_, std::string()); |
| 374 callback_.Reset(); | 376 callback_.Reset(); |
| 375 } | 377 } |
| 376 } | 378 } |
| 377 | 379 |
| 378 } // namespace extensions | 380 } // namespace extensions |
| OLD | NEW |