| 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_util.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 572 |
| 573 std::string FormatTimeAsString(const base::Time& time) { | 573 std::string FormatTimeAsString(const base::Time& time) { |
| 574 base::Time::Exploded exploded; | 574 base::Time::Exploded exploded; |
| 575 time.UTCExplode(&exploded); | 575 time.UTCExplode(&exploded); |
| 576 return base::StringPrintf( | 576 return base::StringPrintf( |
| 577 "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | 577 "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", |
| 578 exploded.year, exploded.month, exploded.day_of_month, | 578 exploded.year, exploded.month, exploded.day_of_month, |
| 579 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); | 579 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void PrepareWritableFileAndRun(Profile* profile, |
| 583 const FilePath& path, |
| 584 const OpenFileCallback& callback) { |
| 585 if (IsUnderGDataMountPoint(path)) { |
| 586 FilePath remote_path(ExtractGDataPath(path)); |
| 587 GetGDataFileSystem(profile)->PrepareWritableFileAndRun(remote_path, |
| 588 callback); |
| 589 } else { |
| 590 if (!callback.is_null()) { |
| 591 content::BrowserThread::GetBlockingPool()->PostTask( |
| 592 FROM_HERE, base::Bind(callback, GDATA_FILE_OK, path)); |
| 593 } |
| 594 } |
| 595 } |
| 596 |
| 582 } // namespace util | 597 } // namespace util |
| 583 } // namespace gdata | 598 } // namespace gdata |
| OLD | NEW |