| 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/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.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/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, | 143 std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, |
| 144 const base::FilePath& root_directory) { | 144 const base::FilePath& root_directory) { |
| 145 ComponentExtensionInfo info(parsed_manifest, root_directory); | 145 ComponentExtensionInfo info(parsed_manifest, root_directory); |
| 146 component_extensions_.push_back(info); | 146 component_extensions_.push_back(info); |
| 147 if (extension_service_->is_ready()) | 147 if (extension_service_->is_ready()) |
| 148 Load(info); | 148 Load(info); |
| 149 return info.extension_id; | 149 return info.extension_id; |
| 150 } | 150 } |
| 151 | 151 |
| 152 std::string ComponentLoader::AddOrReplace(const base::FilePath& path) { | 152 std::string ComponentLoader::AddOrReplace(const base::FilePath& path) { |
| 153 base::FilePath absolute_path = path; | 153 base::FilePath absolute_path = base::MakeAbsoluteFilePath(path); |
| 154 file_util::AbsolutePath(&absolute_path); | |
| 155 std::string error; | 154 std::string error; |
| 156 scoped_ptr<DictionaryValue> manifest( | 155 scoped_ptr<DictionaryValue> manifest( |
| 157 extension_file_util::LoadManifest(absolute_path, &error)); | 156 extension_file_util::LoadManifest(absolute_path, &error)); |
| 158 if (!manifest.get()) { | 157 if (!manifest.get()) { |
| 159 LOG(ERROR) << "Could not load extension from '" << | 158 LOG(ERROR) << "Could not load extension from '" << |
| 160 absolute_path.value() << "'. " << error; | 159 absolute_path.value() << "'. " << error; |
| 161 return NULL; | 160 return NULL; |
| 162 } | 161 } |
| 163 Remove(GenerateId(manifest.get(), absolute_path)); | 162 Remove(GenerateId(manifest.get(), absolute_path)); |
| 164 | 163 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 475 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 477 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 476 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
| 478 std::string() /* default_value */, | 477 std::string() /* default_value */, |
| 479 PrefRegistrySyncable::UNSYNCABLE_PREF); | 478 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 480 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 479 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
| 481 std::string() /* default_value */, | 480 std::string() /* default_value */, |
| 482 PrefRegistrySyncable::UNSYNCABLE_PREF); | 481 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 483 } | 482 } |
| 484 | 483 |
| 485 } // namespace extensions | 484 } // namespace extensions |
| OLD | NEW |