| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
| 13 #include "chrome/browser/extensions/crx_installer.h" | 13 #include "chrome/browser/extensions/crx_installer.h" |
| 14 #include "chrome/browser/extensions/extension_browser_event_router.h" | 14 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 15 #include "chrome/browser/extensions/extension_dom_ui.h" | 15 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 16 #include "chrome/browser/extensions/extension_file_util.h" | 16 #include "chrome/browser/extensions/extension_file_util.h" |
| 17 #include "chrome/browser/extensions/extension_updater.h" | 17 #include "chrome/browser/extensions/extension_updater.h" |
| 18 #include "chrome/browser/extensions/external_extension_provider.h" | 18 #include "chrome/browser/extensions/external_extension_provider.h" |
| 19 #include "chrome/browser/extensions/external_pref_extension_provider.h" | 19 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
| 20 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
| 21 #include "chrome/browser/net/chrome_url_request_context.h" | 21 #include "chrome/browser/net/chrome_url_request_context.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/extensions/extension_error_reporter.h" | 25 #include "chrome/common/extensions/extension_error_reporter.h" |
| 25 #include "chrome/common/notification_service.h" | 26 #include "chrome/common/notification_service.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/pref_service.h" | 28 #include "chrome/common/pref_service.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 | 30 |
| 30 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 31 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" | 32 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 DictionaryValue* manifest, const std::string& id, | 274 DictionaryValue* manifest, const std::string& id, |
| 274 const FilePath& path, Extension::Location location) { | 275 const FilePath& path, Extension::Location location) { |
| 275 std::string error; | 276 std::string error; |
| 276 Extension* extension = NULL; | 277 Extension* extension = NULL; |
| 277 if (manifest) { | 278 if (manifest) { |
| 278 scoped_ptr<Extension> tmp(new Extension(path)); | 279 scoped_ptr<Extension> tmp(new Extension(path)); |
| 279 if (tmp->InitFromValue(*manifest, true, &error)) { | 280 if (tmp->InitFromValue(*manifest, true, &error)) { |
| 280 extension = tmp.release(); | 281 extension = tmp.release(); |
| 281 } | 282 } |
| 282 } else { | 283 } else { |
| 283 // TODO(mpcomplete): obsolete. remove after migration period. | 284 error = extension_manifest_errors::kManifestUnreadable; |
| 284 // http://code.google.com/p/chromium/issues/detail?id=19733 | |
| 285 extension = extension_file_util::LoadExtension(path, | |
| 286 true, // Require id | |
| 287 &error); | |
| 288 } | 285 } |
| 289 | 286 |
| 290 if (!extension) { | 287 if (!extension) { |
| 291 ReportExtensionLoadError(path, | 288 ReportExtensionLoadError(path, |
| 292 error, | 289 error, |
| 293 NotificationType::EXTENSION_INSTALL_ERROR, | 290 NotificationType::EXTENSION_INSTALL_ERROR, |
| 294 false); | 291 false); |
| 295 return; | 292 return; |
| 296 } | 293 } |
| 297 | 294 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 linked_ptr<ExternalExtensionProvider>(test_provider); | 812 linked_ptr<ExternalExtensionProvider>(test_provider); |
| 816 } | 813 } |
| 817 | 814 |
| 818 void ExtensionsServiceBackend::OnExternalExtensionFound( | 815 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 819 const std::string& id, const Version* version, const FilePath& path, | 816 const std::string& id, const Version* version, const FilePath& path, |
| 820 Extension::Location location) { | 817 Extension::Location location) { |
| 821 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, | 818 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, |
| 822 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), | 819 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), |
| 823 path, location)); | 820 path, location)); |
| 824 } | 821 } |
| OLD | NEW |