| 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/browser/media_galleries/fileapi/picasa_data_provider.h" | 5 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 scoped_ptr<AlbumMap> PicasaDataProvider::GetAlbums() { | 91 scoped_ptr<AlbumMap> PicasaDataProvider::GetAlbums() { |
| 92 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 92 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); |
| 93 DCHECK(state_ == LIST_OF_ALBUMS_AND_FOLDERS_FRESH_STATE || | 93 DCHECK(state_ == LIST_OF_ALBUMS_AND_FOLDERS_FRESH_STATE || |
| 94 state_ == ALBUMS_IMAGES_FRESH_STATE); | 94 state_ == ALBUMS_IMAGES_FRESH_STATE); |
| 95 return make_scoped_ptr(new AlbumMap(album_map_)); | 95 return make_scoped_ptr(new AlbumMap(album_map_)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 scoped_ptr<AlbumImages> PicasaDataProvider::FindAlbumImages( | 98 scoped_ptr<AlbumImages> PicasaDataProvider::FindAlbumImages( |
| 99 const std::string& key, | 99 const std::string& key, |
| 100 base::PlatformFileError* error) { | 100 base::File::Error* error) { |
| 101 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 101 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); |
| 102 DCHECK(state_ == ALBUMS_IMAGES_FRESH_STATE); | 102 DCHECK(state_ == ALBUMS_IMAGES_FRESH_STATE); |
| 103 DCHECK(error); | 103 DCHECK(error); |
| 104 | 104 |
| 105 AlbumImagesMap::const_iterator it = albums_images_.find(key); | 105 AlbumImagesMap::const_iterator it = albums_images_.find(key); |
| 106 | 106 |
| 107 if (it == albums_images_.end()) { | 107 if (it == albums_images_.end()) { |
| 108 *error = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 108 *error = base::File::FILE_ERROR_NOT_FOUND; |
| 109 return scoped_ptr<AlbumImages>(); | 109 return scoped_ptr<AlbumImages>(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 *error = base::PLATFORM_FILE_OK; | 112 *error = base::File::FILE_OK; |
| 113 return make_scoped_ptr(new AlbumImages(it->second)); | 113 return make_scoped_ptr(new AlbumImages(it->second)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void PicasaDataProvider::InvalidateData() { | 116 void PicasaDataProvider::InvalidateData() { |
| 117 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 117 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); |
| 118 | 118 |
| 119 // Set data state to stale and ignore responses from any in-flight processes. | 119 // Set data state to stale and ignore responses from any in-flight processes. |
| 120 // TODO(tommycli): Implement and call Cancel function for these | 120 // TODO(tommycli): Implement and call Cancel function for these |
| 121 // UtilityProcessHostClients to actually kill the in-flight processes. | 121 // UtilityProcessHostClients to actually kill the in-flight processes. |
| 122 state_ = STALE_DATA_STATE; | 122 state_ = STALE_DATA_STATE; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (total_counts[name] != 1) { | 258 if (total_counts[name] != 1) { |
| 259 name = base::StringPrintf("%s (%d)", name.c_str(), | 259 name = base::StringPrintf("%s (%d)", name.c_str(), |
| 260 ++current_counts[name]); | 260 ++current_counts[name]); |
| 261 } | 261 } |
| 262 | 262 |
| 263 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i])); | 263 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i])); |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace picasa | 267 } // namespace picasa |
| OLD | NEW |