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