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/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 scoped_ptr<base::Value> root_value; | 2230 scoped_ptr<base::Value> root_value; |
2231 std::string contents; | 2231 std::string contents; |
2232 if (!file_util::ReadFileToString(file_path, &contents)) { | 2232 if (!file_util::ReadFileToString(file_path, &contents)) { |
2233 *error = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 2233 *error = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
2234 return; | 2234 return; |
2235 } | 2235 } |
2236 | 2236 |
2237 int unused_error_code = -1; | 2237 int unused_error_code = -1; |
2238 std::string unused_error_message; | 2238 std::string unused_error_message; |
2239 root_value.reset(base::JSONReader::ReadAndReturnError( | 2239 root_value.reset(base::JSONReader::ReadAndReturnError( |
2240 contents, false, &unused_error_code, &unused_error_message)); | 2240 contents, base::JSON_PARSE_RFC, &unused_error_code, |
| 2241 &unused_error_message)); |
2241 | 2242 |
2242 bool has_root = root_value.get(); | 2243 bool has_root = root_value.get(); |
2243 if (!has_root) | 2244 if (!has_root) |
2244 LOG(WARNING) << "Cached content read failed for file " << file_path.value(); | 2245 LOG(WARNING) << "Cached content read failed for file " << file_path.value(); |
2245 | 2246 |
2246 if (!has_root) { | 2247 if (!has_root) { |
2247 *error = base::PLATFORM_FILE_ERROR_FAILED; | 2248 *error = base::PLATFORM_FILE_ERROR_FAILED; |
2248 return; | 2249 return; |
2249 } | 2250 } |
2250 | 2251 |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4114 pref_registrar_->Init(profile_->GetPrefs()); | 4115 pref_registrar_->Init(profile_->GetPrefs()); |
4115 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this); | 4116 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this); |
4116 } | 4117 } |
4117 | 4118 |
4118 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { | 4119 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { |
4119 delete global_free_disk_getter_for_testing; // Safe to delete NULL; | 4120 delete global_free_disk_getter_for_testing; // Safe to delete NULL; |
4120 global_free_disk_getter_for_testing = getter; | 4121 global_free_disk_getter_for_testing = getter; |
4121 } | 4122 } |
4122 | 4123 |
4123 } // namespace gdata | 4124 } // namespace gdata |
OLD | NEW |