Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698