| 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/installed_loader.h" | 5 #include "chrome/browser/extensions/installed_loader.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 policy->MustRemainDisabled(extension, &disable_reason, NULL)) { | 164 policy->MustRemainDisabled(extension, &disable_reason, NULL)) { |
| 165 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); | 165 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); |
| 166 extension_prefs_->AddDisableReason(extension->id(), disable_reason); | 166 extension_prefs_->AddDisableReason(extension->id(), disable_reason); |
| 167 force_disabled = true; | 167 force_disabled = true; |
| 168 } | 168 } |
| 169 UMA_HISTOGRAM_BOOLEAN("ExtensionInstalledLoader.ForceDisabled", | 169 UMA_HISTOGRAM_BOOLEAN("ExtensionInstalledLoader.ForceDisabled", |
| 170 force_disabled); | 170 force_disabled); |
| 171 } | 171 } |
| 172 | 172 |
| 173 if (!extension.get()) { | 173 if (!extension.get()) { |
| 174 extension_service_->ReportExtensionLoadError( | 174 extension_service_->ReportExtensionLoadError(info.extension_path, error); |
| 175 info.extension_path, error, false); | |
| 176 return; | 175 return; |
| 177 } | 176 } |
| 178 | 177 |
| 179 if (write_to_prefs) | 178 if (write_to_prefs) |
| 180 extension_prefs_->UpdateManifest(extension.get()); | 179 extension_prefs_->UpdateManifest(extension.get()); |
| 181 | 180 |
| 182 extension_service_->AddExtension(extension.get()); | 181 extension_service_->AddExtension(extension.get()); |
| 183 } | 182 } |
| 184 | 183 |
| 185 void InstalledLoader::LoadAllExtensions() { | 184 void InstalledLoader::LoadAllExtensions() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 216 |
| 218 std::string error; | 217 std::string error; |
| 219 scoped_refptr<const Extension> extension( | 218 scoped_refptr<const Extension> extension( |
| 220 file_util::LoadExtension(info->extension_path, | 219 file_util::LoadExtension(info->extension_path, |
| 221 info->extension_location, | 220 info->extension_location, |
| 222 GetCreationFlags(info), | 221 GetCreationFlags(info), |
| 223 &error)); | 222 &error)); |
| 224 | 223 |
| 225 if (!extension.get()) { | 224 if (!extension.get()) { |
| 226 extension_service_->ReportExtensionLoadError( | 225 extension_service_->ReportExtensionLoadError( |
| 227 info->extension_path, error, false); | 226 info->extension_path, error); |
| 228 continue; | 227 continue; |
| 229 } | 228 } |
| 230 | 229 |
| 231 extensions_info->at(i)->extension_manifest.reset( | 230 extensions_info->at(i)->extension_manifest.reset( |
| 232 static_cast<base::DictionaryValue*>( | 231 static_cast<base::DictionaryValue*>( |
| 233 extension->manifest()->value()->DeepCopy())); | 232 extension->manifest()->value()->DeepCopy())); |
| 234 should_write_prefs = true; | 233 should_write_prefs = true; |
| 235 } | 234 } |
| 236 } | 235 } |
| 237 | 236 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 476 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
| 478 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 477 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
| 479 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 478 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
| 480 flags |= Extension::REQUIRE_KEY; | 479 flags |= Extension::REQUIRE_KEY; |
| 481 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 480 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 482 flags |= Extension::ALLOW_FILE_ACCESS; | 481 flags |= Extension::ALLOW_FILE_ACCESS; |
| 483 return flags; | 482 return flags; |
| 484 } | 483 } |
| 485 | 484 |
| 486 } // namespace extensions | 485 } // namespace extensions |
| OLD | NEW |