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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 580 |
581 std::string FormatTimeAsString(const base::Time& time) { | 581 std::string FormatTimeAsString(const base::Time& time) { |
582 base::Time::Exploded exploded; | 582 base::Time::Exploded exploded; |
583 time.UTCExplode(&exploded); | 583 time.UTCExplode(&exploded); |
584 return base::StringPrintf( | 584 return base::StringPrintf( |
585 "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | 585 "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", |
586 exploded.year, exploded.month, exploded.day_of_month, | 586 exploded.year, exploded.month, exploded.day_of_month, |
587 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); | 587 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
588 } | 588 } |
589 | 589 |
| 590 std::string FormatTimeAsStringLocaltime(const base::Time& time) { |
| 591 base::Time::Exploded exploded; |
| 592 time.LocalExplode(&exploded); |
| 593 |
| 594 return base::StringPrintf( |
| 595 "%04d-%02d-%02dT%02d:%02d:%02d.%03d", |
| 596 exploded.year, exploded.month, exploded.day_of_month, |
| 597 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
| 598 } |
| 599 |
590 void PrepareWritableFileAndRun(Profile* profile, | 600 void PrepareWritableFileAndRun(Profile* profile, |
591 const FilePath& path, | 601 const FilePath& path, |
592 const OpenFileCallback& callback) { | 602 const OpenFileCallback& callback) { |
593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 603 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
594 if (IsUnderGDataMountPoint(path)) { | 604 if (IsUnderGDataMountPoint(path)) { |
595 FileWriteHelper* file_write_helper = GetFileWriteHelper(profile); | 605 FileWriteHelper* file_write_helper = GetFileWriteHelper(profile); |
596 if (!file_write_helper) | 606 if (!file_write_helper) |
597 return; | 607 return; |
598 FilePath remote_path(ExtractGDataPath(path)); | 608 FilePath remote_path(ExtractGDataPath(path)); |
599 file_write_helper->PrepareWritableFileAndRun(remote_path, callback); | 609 file_write_helper->PrepareWritableFileAndRun(remote_path, callback); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 const base::Closure& reply_task) { | 652 const base::Closure& reply_task) { |
643 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
644 | 654 |
645 const bool posted = blocking_task_runner->PostTaskAndReply( | 655 const bool posted = blocking_task_runner->PostTaskAndReply( |
646 from_here, request_task, reply_task); | 656 from_here, request_task, reply_task); |
647 DCHECK(posted); | 657 DCHECK(posted); |
648 } | 658 } |
649 | 659 |
650 } // namespace util | 660 } // namespace util |
651 } // namespace gdata | 661 } // namespace gdata |
OLD | NEW |