| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 base::FilePath json_file = base_path_.Append(kExternalExtensionJson); | 158 base::FilePath json_file = base_path_.Append(kExternalExtensionJson); |
| 159 | 159 |
| 160 if (!base::PathExists(json_file)) { | 160 if (!base::PathExists(json_file)) { |
| 161 // This is not an error. The file does not exist by default. | 161 // This is not an error. The file does not exist by default. |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 | 164 |
| 165 if (IsOptionSet(ENSURE_PATH_CONTROLLED_BY_ADMIN)) { | 165 if (IsOptionSet(ENSURE_PATH_CONTROLLED_BY_ADMIN)) { |
| 166 #if defined(OS_MACOSX) | 166 #if defined(OS_MACOSX) |
| 167 if (!file_util::VerifyPathControlledByAdmin(json_file)) { | 167 if (!base::VerifyPathControlledByAdmin(json_file)) { |
| 168 LOG(ERROR) << "Can not read external extensions source. The file " | 168 LOG(ERROR) << "Can not read external extensions source. The file " |
| 169 << json_file.value() << " and every directory in its path, " | 169 << json_file.value() << " and every directory in its path, " |
| 170 << "must be owned by root, have group \"admin\", and not be " | 170 << "must be owned by root, have group \"admin\", and not be " |
| 171 << "writable by all users. These restrictions prevent " | 171 << "writable by all users. These restrictions prevent " |
| 172 << "unprivleged users from making chrome install extensions " | 172 << "unprivleged users from making chrome install extensions " |
| 173 << "on other users' accounts."; | 173 << "on other users' accounts."; |
| 174 return; | 174 return; |
| 175 } | 175 } |
| 176 #else | 176 #else |
| 177 // The only platform that uses this check is Mac OS. If you add one, | 177 // The only platform that uses this check is Mac OS. If you add one, |
| 178 // you need to implement file_util::VerifyPathControlledByAdmin() for | 178 // you need to implement base::VerifyPathControlledByAdmin() for |
| 179 // that platform. | 179 // that platform. |
| 180 NOTREACHED(); | 180 NOTREACHED(); |
| 181 #endif // defined(OS_MACOSX) | 181 #endif // defined(OS_MACOSX) |
| 182 } | 182 } |
| 183 | 183 |
| 184 JSONFileValueSerializer serializer(json_file); | 184 JSONFileValueSerializer serializer(json_file); |
| 185 scoped_ptr<base::DictionaryValue> ext_prefs( | 185 scoped_ptr<base::DictionaryValue> ext_prefs( |
| 186 ExtractExtensionPrefs(&serializer, json_file)); | 186 ExtractExtensionPrefs(&serializer, json_file)); |
| 187 if (ext_prefs) | 187 if (ext_prefs) |
| 188 prefs->MergeDictionary(ext_prefs.get()); | 188 prefs->MergeDictionary(ext_prefs.get()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |