| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 if (!file_util::DirectoryExists(meta_cache_path)) { | 1380 if (!file_util::DirectoryExists(meta_cache_path)) { |
| 1381 if (!file_util::CreateDirectory(meta_cache_path)) { | 1381 if (!file_util::CreateDirectory(meta_cache_path)) { |
| 1382 LOG(WARNING) << "GData metadata cache directory can't be created at " | 1382 LOG(WARNING) << "GData metadata cache directory can't be created at " |
| 1383 << meta_cache_path.value(); | 1383 << meta_cache_path.value(); |
| 1384 return; | 1384 return; |
| 1385 } | 1385 } |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 FilePath file_name = meta_cache_path.Append(name); | 1388 FilePath file_name = meta_cache_path.Append(name); |
| 1389 std::string json; | 1389 std::string json; |
| 1390 base::JSONWriter::Write(feed.get(), | 1390 base::JSONWriter::Write(feed.get(), &json); |
| 1391 false, // pretty_print | |
| 1392 &json); | |
| 1393 | 1391 |
| 1394 int file_size = static_cast<int>(json.length()); | 1392 int file_size = static_cast<int>(json.length()); |
| 1395 if (file_util::WriteFile(file_name, json.data(), file_size) != file_size) { | 1393 if (file_util::WriteFile(file_name, json.data(), file_size) != file_size) { |
| 1396 LOG(WARNING) << "GData metadata file can't be stored at " | 1394 LOG(WARNING) << "GData metadata file can't be stored at " |
| 1397 << file_name.value(); | 1395 << file_name.value(); |
| 1398 if (!file_util::Delete(file_name, true)) { | 1396 if (!file_util::Delete(file_name, true)) { |
| 1399 LOG(WARNING) << "GData metadata file can't be deleted at " | 1397 LOG(WARNING) << "GData metadata file can't be deleted at " |
| 1400 << file_name.value(); | 1398 << file_name.value(); |
| 1401 return; | 1399 return; |
| 1402 } | 1400 } |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 | 2004 |
| 2007 GDataFileSystemFactory::~GDataFileSystemFactory() { | 2005 GDataFileSystemFactory::~GDataFileSystemFactory() { |
| 2008 } | 2006 } |
| 2009 | 2007 |
| 2010 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( | 2008 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( |
| 2011 Profile* profile) const { | 2009 Profile* profile) const { |
| 2012 return new GDataFileSystem(profile, new DocumentsService); | 2010 return new GDataFileSystem(profile, new DocumentsService); |
| 2013 } | 2011 } |
| 2014 | 2012 |
| 2015 } // namespace gdata | 2013 } // namespace gdata |
| OLD | NEW |