Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.cc

Issue 10823226: Get AboutResource as account metadata for Drive V2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/metrics/histogram.h" 5 #include "base/metrics/histogram.h"
6 #include "chrome/browser/chromeos/gdata/gdata_files.h" 6 #include "chrome/browser/chromeos/gdata/gdata_files.h"
7 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h" 7 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 9
10 using content::BrowserThread; 10 using content::BrowserThread;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 GDataWapiFeedProcessor::GDataWapiFeedProcessor( 42 GDataWapiFeedProcessor::GDataWapiFeedProcessor(
43 GDataDirectoryService* directory_service) 43 GDataDirectoryService* directory_service)
44 : directory_service_(directory_service) { 44 : directory_service_(directory_service) {
45 } 45 }
46 46
47 GDataWapiFeedProcessor::~GDataWapiFeedProcessor() { 47 GDataWapiFeedProcessor::~GDataWapiFeedProcessor() {
48 } 48 }
49 49
50 GDataFileError GDataWapiFeedProcessor::ApplyFeeds( 50 GDataFileError GDataWapiFeedProcessor::ApplyFeeds(
51 const std::vector<DocumentFeed*>& feed_list, 51 const std::vector<DocumentFeed*>& feed_list,
52 int start_changestamp, 52 int64 start_changestamp,
53 int root_feed_changestamp, 53 int64 root_feed_changestamp,
54 std::set<FilePath>* changed_dirs) { 54 std::set<FilePath>* changed_dirs) {
55 bool is_delta_feed = start_changestamp != 0; 55 bool is_delta_feed = start_changestamp != 0;
56 56
57 directory_service_->set_origin(FROM_SERVER); 57 directory_service_->set_origin(FROM_SERVER);
58 58
59 int delta_feed_changestamp = 0; 59 int64 delta_feed_changestamp = 0;
60 FeedToFileResourceMapUmaStats uma_stats; 60 FeedToFileResourceMapUmaStats uma_stats;
61 FileResourceIdMap file_map; 61 FileResourceIdMap file_map;
62 GDataFileError error = FeedToFileResourceMap(feed_list, 62 GDataFileError error = FeedToFileResourceMap(feed_list,
63 &file_map, 63 &file_map,
64 &delta_feed_changestamp, 64 &delta_feed_changestamp,
65 &uma_stats); 65 &uma_stats);
66 if (error != GDATA_FILE_OK) 66 if (error != GDATA_FILE_OK)
67 return error; 67 return error;
68 68
69 ApplyFeedFromFileUrlMap( 69 ApplyFeedFromFileUrlMap(
(...skipping 27 matching lines...) Expand all
97 const int count = iter->second; 97 const int count = iter->second;
98 for (int i = 0; i < count; ++i) { 98 for (int i = 0; i < count; ++i) {
99 UMA_HISTOGRAM_CUSTOM_ENUMERATION( 99 UMA_HISTOGRAM_CUSTOM_ENUMERATION(
100 "GData.EntryKind", kind, all_entry_kinds); 100 "GData.EntryKind", kind, all_entry_kinds);
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 void GDataWapiFeedProcessor::ApplyFeedFromFileUrlMap( 105 void GDataWapiFeedProcessor::ApplyFeedFromFileUrlMap(
106 bool is_delta_feed, 106 bool is_delta_feed,
107 int feed_changestamp, 107 int64 feed_changestamp,
108 FileResourceIdMap* file_map, 108 FileResourceIdMap* file_map,
109 std::set<FilePath>* changed_dirs) { 109 std::set<FilePath>* changed_dirs) {
110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
111 DCHECK(changed_dirs); 111 DCHECK(changed_dirs);
112 112
113 if (!is_delta_feed) { // Full update. 113 if (!is_delta_feed) { // Full update.
114 directory_service_->root()->RemoveChildren(); 114 directory_service_->root()->RemoveChildren();
115 changed_dirs->insert(directory_service_->root()->GetFilePath()); 115 changed_dirs->insert(directory_service_->root()->GetFilePath());
116 } 116 }
117 directory_service_->set_largest_changestamp(feed_changestamp); 117 directory_service_->set_largest_changestamp(feed_changestamp);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 dir = orphaned_dir_service->root(); 250 dir = orphaned_dir_service->root();
251 } 251 }
252 } 252 }
253 } 253 }
254 return dir; 254 return dir;
255 } 255 }
256 256
257 GDataFileError GDataWapiFeedProcessor::FeedToFileResourceMap( 257 GDataFileError GDataWapiFeedProcessor::FeedToFileResourceMap(
258 const std::vector<DocumentFeed*>& feed_list, 258 const std::vector<DocumentFeed*>& feed_list,
259 FileResourceIdMap* file_map, 259 FileResourceIdMap* file_map,
260 int* feed_changestamp, 260 int64* feed_changestamp,
261 FeedToFileResourceMapUmaStats* uma_stats) { 261 FeedToFileResourceMapUmaStats* uma_stats) {
262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
263 DCHECK(uma_stats); 263 DCHECK(uma_stats);
264 264
265 GDataFileError error = GDATA_FILE_OK; 265 GDataFileError error = GDATA_FILE_OK;
266 uma_stats->num_regular_files = 0; 266 uma_stats->num_regular_files = 0;
267 uma_stats->num_hosted_documents = 0; 267 uma_stats->num_hosted_documents = 0;
268 uma_stats->num_files_with_entry_kind.clear(); 268 uma_stats->num_files_with_entry_kind.clear();
269 for (size_t i = 0; i < feed_list.size(); ++i) { 269 for (size_t i = 0; i < feed_list.size(); ++i) {
270 const DocumentFeed* feed = feed_list[i]; 270 const DocumentFeed* feed = feed_list[i];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // If the code above fails to parse a feed, any GDataEntry instance 322 // If the code above fails to parse a feed, any GDataEntry instance
323 // added to |file_by_url| is not managed by a GDataDirectory instance, 323 // added to |file_by_url| is not managed by a GDataDirectory instance,
324 // so we need to explicitly release them here. 324 // so we need to explicitly release them here.
325 STLDeleteValues(file_map); 325 STLDeleteValues(file_map);
326 } 326 }
327 327
328 return error; 328 return error;
329 } 329 }
330 330
331 } // namespace gdata 331 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h ('k') | chrome/browser/chromeos/gdata/gdata_wapi_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698