| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 11 #include "base/json/json_file_value_serializer.h" | 13 #include "base/json/json_file_value_serializer.h" |
| 12 #include "base/json/json_string_value_serializer.h" | 14 #include "base/json/json_string_value_serializer.h" |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 std::string error_msg; | 81 std::string error_msg; |
| 80 scoped_ptr<base::Value> extensions = | 82 scoped_ptr<base::Value> extensions = |
| 81 deserializer->Deserialize(NULL, &error_msg); | 83 deserializer->Deserialize(NULL, &error_msg); |
| 82 if (!extensions) { | 84 if (!extensions) { |
| 83 LOG(WARNING) << "Unable to deserialize json data: " << error_msg | 85 LOG(WARNING) << "Unable to deserialize json data: " << error_msg |
| 84 << " in file " << path.value() << "."; | 86 << " in file " << path.value() << "."; |
| 85 return make_scoped_ptr(new base::DictionaryValue); | 87 return make_scoped_ptr(new base::DictionaryValue); |
| 86 } | 88 } |
| 87 | 89 |
| 88 scoped_ptr<base::DictionaryValue> ext_dictionary = | 90 scoped_ptr<base::DictionaryValue> ext_dictionary = |
| 89 base::DictionaryValue::From(extensions.Pass()); | 91 base::DictionaryValue::From(std::move(extensions)); |
| 90 if (ext_dictionary) { | 92 if (ext_dictionary) { |
| 91 return ext_dictionary; | 93 return ext_dictionary; |
| 92 } | 94 } |
| 93 | 95 |
| 94 LOG(WARNING) << "Expected a JSON dictionary in file " << path.value() | 96 LOG(WARNING) << "Expected a JSON dictionary in file " << path.value() |
| 95 << "."; | 97 << "."; |
| 96 return make_scoped_ptr(new base::DictionaryValue); | 98 return make_scoped_ptr(new base::DictionaryValue); |
| 97 | 99 |
| 98 } | 100 } |
| 99 | 101 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 LoadFinished(); | 331 LoadFinished(); |
| 330 } | 332 } |
| 331 | 333 |
| 332 ExternalTestingLoader::~ExternalTestingLoader() {} | 334 ExternalTestingLoader::~ExternalTestingLoader() {} |
| 333 | 335 |
| 334 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { | 336 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { |
| 335 return fake_base_path_; | 337 return fake_base_path_; |
| 336 } | 338 } |
| 337 | 339 |
| 338 } // namespace extensions | 340 } // namespace extensions |
| OLD | NEW |