| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/media_galleries/picasa_album_table_reader.h" | 5 #include "chrome/utility/media_galleries/picasa_album_table_reader.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> |
| 11 | 12 |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/common/media_galleries/pmp_constants.h" | 15 #include "chrome/common/media_galleries/pmp_constants.h" |
| 15 #include "chrome/utility/media_galleries/pmp_column_reader.h" | 16 #include "chrome/utility/media_galleries/pmp_column_reader.h" |
| 16 | 17 |
| 17 namespace picasa { | 18 namespace picasa { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // |variant_time| is specified as the number of days from Dec 30, 1899. | 22 // |variant_time| is specified as the number of days from Dec 30, 1899. |
| 22 base::Time TimeFromMicrosoftVariantTime(double variant_time) { | 23 base::Time TimeFromMicrosoftVariantTime(double variant_time) { |
| 23 base::TimeDelta variant_delta = base::TimeDelta::FromMicroseconds( | 24 base::TimeDelta variant_delta = base::TimeDelta::FromMicroseconds( |
| 24 static_cast<int64_t>(variant_time * base::Time::kMicrosecondsPerDay)); | 25 static_cast<int64_t>(variant_time * base::Time::kMicrosecondsPerDay)); |
| 25 | 26 |
| 26 return base::Time::FromLocalExploded(kPmpVariantTimeEpoch) + variant_delta; | 27 return base::Time::FromLocalExploded(kPmpVariantTimeEpoch) + variant_delta; |
| 27 } | 28 } |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 PicasaAlbumTableReader::PicasaAlbumTableReader(AlbumTableFiles table_files) | 32 PicasaAlbumTableReader::PicasaAlbumTableReader(AlbumTableFiles table_files) |
| 32 : table_files_(table_files.Pass()), | 33 : table_files_(std::move(table_files)), initialized_(false) {} |
| 33 initialized_(false) { | |
| 34 } | |
| 35 | 34 |
| 36 PicasaAlbumTableReader::~PicasaAlbumTableReader() { | 35 PicasaAlbumTableReader::~PicasaAlbumTableReader() { |
| 37 } | 36 } |
| 38 | 37 |
| 39 const std::vector<AlbumInfo>& PicasaAlbumTableReader::folders() const { | 38 const std::vector<AlbumInfo>& PicasaAlbumTableReader::folders() const { |
| 40 DCHECK(initialized_); | 39 DCHECK(initialized_); |
| 41 return folders_; | 40 return folders_; |
| 42 } | 41 } |
| 43 | 42 |
| 44 const std::vector<AlbumInfo>& PicasaAlbumTableReader::albums() const { | 43 const std::vector<AlbumInfo>& PicasaAlbumTableReader::albums() const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 108 |
| 110 folders_.push_back(AlbumInfo(name, timestamp, uid, path)); | 109 folders_.push_back(AlbumInfo(name, timestamp, uid, path)); |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 initialized_ = true; | 113 initialized_ = true; |
| 115 return true; | 114 return true; |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace picasa | 117 } // namespace picasa |
| OLD | NEW |