| 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/external_pref_loader.h" | 5 #include "chrome/browser/extensions/external_pref_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 // For each file read the json description & build the proper | 204 // For each file read the json description & build the proper |
| 205 // associated prefs. | 205 // associated prefs. |
| 206 for (std::set<base::FilePath>::const_iterator it = candidates.begin(); | 206 for (std::set<base::FilePath>::const_iterator it = candidates.begin(); |
| 207 it != candidates.end(); | 207 it != candidates.end(); |
| 208 ++it) { | 208 ++it) { |
| 209 base::FilePath extension_candidate_path = base_path_.Append(*it); | 209 base::FilePath extension_candidate_path = base_path_.Append(*it); |
| 210 | 210 |
| 211 std::string id = | 211 std::string id = |
| 212 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
| 213 WideToASCII( | 213 base::UTF16ToASCII( |
| 214 extension_candidate_path.RemoveExtension().BaseName().value()); | 214 extension_candidate_path.RemoveExtension().BaseName().value()); |
| 215 #elif defined(OS_POSIX) | 215 #elif defined(OS_POSIX) |
| 216 extension_candidate_path.RemoveExtension().BaseName().value().c_str(); | 216 extension_candidate_path.RemoveExtension().BaseName().value().c_str(); |
| 217 #endif | 217 #endif |
| 218 | 218 |
| 219 DVLOG(1) << "Reading json file: " | 219 DVLOG(1) << "Reading json file: " |
| 220 << extension_candidate_path.LossyDisplayName().c_str(); | 220 << extension_candidate_path.LossyDisplayName().c_str(); |
| 221 | 221 |
| 222 JSONFileValueSerializer serializer(extension_candidate_path); | 222 JSONFileValueSerializer serializer(extension_candidate_path); |
| 223 scoped_ptr<base::DictionaryValue> ext_prefs( | 223 scoped_ptr<base::DictionaryValue> ext_prefs( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 245 LoadFinished(); | 245 LoadFinished(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 ExternalTestingLoader::~ExternalTestingLoader() {} | 248 ExternalTestingLoader::~ExternalTestingLoader() {} |
| 249 | 249 |
| 250 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { | 250 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { |
| 251 return fake_base_path_; | 251 return fake_base_path_; |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // extensions | 254 } // extensions |
| OLD | NEW |