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_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 GDataFileError error) { | 1075 GDataFileError error) { |
1076 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1076 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1077 | 1077 |
1078 if (error != GDATA_FILE_OK) { | 1078 if (error != GDATA_FILE_OK) { |
1079 if (!params->callback.is_null()) | 1079 if (!params->callback.is_null()) |
1080 params->callback.Run(error, NULL); | 1080 params->callback.Run(error, NULL); |
1081 return; | 1081 return; |
1082 } | 1082 } |
1083 | 1083 |
1084 error = UpdateFromFeed(*params->feed_list, | 1084 error = UpdateFromFeed(*params->feed_list, |
1085 FROM_SERVER, | |
1086 params->start_changestamp, | 1085 params->start_changestamp, |
1087 params->root_feed_changestamp); | 1086 params->root_feed_changestamp); |
1088 | 1087 |
1089 if (error != GDATA_FILE_OK) { | 1088 if (error != GDATA_FILE_OK) { |
1090 if (!params->callback.is_null()) | 1089 if (!params->callback.is_null()) |
1091 params->callback.Run(error, NULL); | 1090 params->callback.Run(error, NULL); |
1092 | 1091 |
1093 return; | 1092 return; |
1094 } | 1093 } |
1095 | 1094 |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3268 | 3267 |
3269 // If resource_id is not empty, remove its corresponding file from cache. | 3268 // If resource_id is not empty, remove its corresponding file from cache. |
3270 if (!resource_id.empty()) | 3269 if (!resource_id.empty()) |
3271 cache_->RemoveOnUIThread(resource_id, CacheOperationCallback()); | 3270 cache_->RemoveOnUIThread(resource_id, CacheOperationCallback()); |
3272 | 3271 |
3273 return GDATA_FILE_OK; | 3272 return GDATA_FILE_OK; |
3274 } | 3273 } |
3275 | 3274 |
3276 GDataFileError GDataFileSystem::UpdateFromFeed( | 3275 GDataFileError GDataFileSystem::UpdateFromFeed( |
3277 const std::vector<DocumentFeed*>& feed_list, | 3276 const std::vector<DocumentFeed*>& feed_list, |
3278 ContentOrigin origin, | |
3279 int start_changestamp, | 3277 int start_changestamp, |
3280 int root_feed_changestamp) { | 3278 int root_feed_changestamp) { |
3281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
3282 DVLOG(1) << "Updating directory with a feed"; | 3280 DVLOG(1) << "Updating directory with a feed"; |
3283 | 3281 |
3284 bool is_delta_feed = start_changestamp != 0; | 3282 bool is_delta_feed = start_changestamp != 0; |
3285 | 3283 |
3286 directory_service_->set_origin(origin); | 3284 directory_service_->set_origin(FROM_SERVER); |
3287 | 3285 |
3288 int delta_feed_changestamp = 0; | 3286 int delta_feed_changestamp = 0; |
3289 FeedToFileResourceMapUmaStats uma_stats; | 3287 FeedToFileResourceMapUmaStats uma_stats; |
3290 FileResourceIdMap file_map; | 3288 FileResourceIdMap file_map; |
3291 GDataFileError error = FeedToFileResourceMap(feed_list, | 3289 GDataFileError error = FeedToFileResourceMap(feed_list, |
3292 &file_map, | 3290 &file_map, |
3293 &delta_feed_changestamp, | 3291 &delta_feed_changestamp, |
3294 &uma_stats); | 3292 &uma_stats); |
3295 if (error != GDATA_FILE_OK) | 3293 if (error != GDATA_FILE_OK) |
3296 return error; | 3294 return error; |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4260 } | 4258 } |
4261 | 4259 |
4262 PlatformFileInfoProto entry_file_info; | 4260 PlatformFileInfoProto entry_file_info; |
4263 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 4261 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
4264 *entry_proto->mutable_file_info() = entry_file_info; | 4262 *entry_proto->mutable_file_info() = entry_file_info; |
4265 if (!callback.is_null()) | 4263 if (!callback.is_null()) |
4266 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); | 4264 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); |
4267 } | 4265 } |
4268 | 4266 |
4269 } // namespace gdata | 4267 } // namespace gdata |
OLD | NEW |