| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // album-like entities. We ignore those rows. | 82 // album-like entities. We ignore those rows. |
| 83 if (!category_column.ReadUInt32(i, &category) || | 83 if (!category_column.ReadUInt32(i, &category) || |
| 84 !date_column.ReadDouble64(i, &date) || | 84 !date_column.ReadDouble64(i, &date) || |
| 85 !name_column.ReadString(i, &name) || name.empty() || | 85 !name_column.ReadString(i, &name) || name.empty() || |
| 86 !uid_column.ReadString(i, &uid) || uid.empty()) { | 86 !uid_column.ReadString(i, &uid) || uid.empty()) { |
| 87 continue; | 87 continue; |
| 88 } | 88 } |
| 89 | 89 |
| 90 base::Time timestamp = TimeFromMicrosoftVariantTime(date); | 90 base::Time timestamp = TimeFromMicrosoftVariantTime(date); |
| 91 | 91 |
| 92 switch (category) { | 92 if (category == kAlbumCategoryAlbum) { |
| 93 case kAlbumCategoryAlbum: { | 93 std::string token; |
| 94 std::string token; | 94 if (!token_column.ReadString(i, &token) || token.empty() || |
| 95 if (!token_column.ReadString(i, &token) || token.empty() || | 95 !StartsWithASCII(token, kAlbumTokenPrefix, false)) { |
| 96 !StartsWithASCII(token, kAlbumTokenPrefix, false)) { | 96 continue; |
| 97 continue; | 97 } |
| 98 } | |
| 99 | 98 |
| 100 albums_.push_back(AlbumInfo(name, timestamp, uid, base::FilePath())); | 99 albums_.push_back(AlbumInfo(name, timestamp, uid, base::FilePath())); |
| 101 break; | 100 } else if (category == kAlbumCategoryFolder) { |
| 102 } | 101 std::string filename; |
| 103 case kAlbumCategoryFolder: { | 102 if (!filename_column.ReadString(i, &filename) || filename.empty()) |
| 104 std::string filename; | 103 continue; |
| 105 if (!filename_column.ReadString(i, &filename) || filename.empty()) | |
| 106 continue; | |
| 107 | 104 |
| 108 base::FilePath path = | 105 base::FilePath path = |
| 109 base::FilePath(base::FilePath::FromUTF8Unsafe(filename)); | 106 base::FilePath(base::FilePath::FromUTF8Unsafe(filename)); |
| 110 | 107 |
| 111 folders_.push_back(AlbumInfo(name, timestamp, uid, path)); | 108 folders_.push_back(AlbumInfo(name, timestamp, uid, path)); |
| 112 break; | |
| 113 } | |
| 114 default: { | |
| 115 break; | |
| 116 } | |
| 117 } | 109 } |
| 118 } | 110 } |
| 119 | 111 |
| 120 initialized_ = true; | 112 initialized_ = true; |
| 121 return true; | 113 return true; |
| 122 } | 114 } |
| 123 | 115 |
| 124 } // namespace picasa | 116 } // namespace picasa |
| OLD | NEW |