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

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

Issue 10444082: Refresh drive file system metadata for entries in search results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 "chrome/browser/chromeos/gdata/gdata_files.h" 5 #include "chrome/browser/chromeos/gdata/gdata_files.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 callback.Run(base::PLATFORM_FILE_OK, entry); 536 callback.Run(base::PLATFORM_FILE_OK, entry);
537 else 537 else
538 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, NULL); 538 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, NULL);
539 539
540 return; 540 return;
541 } 541 }
542 } 542 }
543 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, NULL); 543 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, NULL);
544 } 544 }
545 545
546 void GDataRootDirectory::RefreshEntry(
547 scoped_ptr<GDataEntry> fresh_entry) {
548 DCHECK(fresh_entry.get());
549
550 GDataEntry* old_entry = GetEntryByResourceId(fresh_entry->resource_id());
551 GDataDirectory* entry_parent = old_entry ? old_entry->parent() : NULL;
552
553 if (entry_parent) {
554 DCHECK_EQ(fresh_entry->resource_id(), old_entry->resource_id());
555 DCHECK(fresh_entry->AsGDataFile());
556 DCHECK(old_entry->AsGDataFile());
satorux1 2012/05/31 15:56:01 here, we assume |fresh_entry| to be a file. The fu
tbarzic 2012/05/31 19:25:17 Done.
557
558 entry_parent->RemoveEntry(old_entry);
559 entry_parent->AddEntry(fresh_entry.release());
560 }
561 }
562
546 GDataEntry* GDataRootDirectory::GetEntryByResourceId( 563 GDataEntry* GDataRootDirectory::GetEntryByResourceId(
547 const std::string& resource) { 564 const std::string& resource) {
548 // GDataFileSystem has already locked. 565 // GDataFileSystem has already locked.
549 ResourceMap::const_iterator iter = resource_map_.find(resource); 566 ResourceMap::const_iterator iter = resource_map_.find(resource);
550 if (iter == resource_map_.end()) 567 if (iter == resource_map_.end())
551 return NULL; 568 return NULL;
552 return iter->second; 569 return iter->second;
553 } 570 }
554 571
555 // Convert to/from proto. 572 // Convert to/from proto.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 777 }
761 778
762 FromProto(proto); 779 FromProto(proto);
763 set_origin(FROM_CACHE); 780 set_origin(FROM_CACHE);
764 set_refresh_time(base::Time::Now()); 781 set_refresh_time(base::Time::Now());
765 } 782 }
766 return ok; 783 return ok;
767 } 784 }
768 785
769 } // namespace gdata 786 } // namespace gdata
OLDNEW
« chrome/browser/chromeos/gdata/gdata_files.h ('K') | « chrome/browser/chromeos/gdata/gdata_files.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698