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

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

Issue 10837148: gdata: Add GetEntryInfoByPath() and ReadDirectoryByPath() to GDataDirectoryService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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 "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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 DCHECK(entry); 1868 DCHECK(entry);
1869 1869
1870 GDataDirectory* directory = entry->AsGDataDirectory(); 1870 GDataDirectory* directory = entry->AsGDataDirectory();
1871 if (!directory) { 1871 if (!directory) {
1872 if (!callback.is_null()) 1872 if (!callback.is_null())
1873 callback.Run(GDATA_FILE_ERROR_NOT_FOUND, 1873 callback.Run(GDATA_FILE_ERROR_NOT_FOUND,
1874 scoped_ptr<GDataEntryProtoVector>()); 1874 scoped_ptr<GDataEntryProtoVector>());
1875 return; 1875 return;
1876 } 1876 }
1877 1877
1878 scoped_ptr<GDataEntryProtoVector> entries(new GDataEntryProtoVector); 1878 scoped_ptr<GDataEntryProtoVector> entries(directory->ToProtoVector());
1879 for (GDataFileCollection::const_iterator iter =
1880 directory->child_files().begin();
1881 iter != directory->child_files().end(); ++iter) {
1882 GDataEntryProto proto;
1883 static_cast<const GDataEntry*>(iter->second)->ToProtoFull(&proto);
1884 entries->push_back(proto);
1885 }
1886 for (GDataDirectoryCollection::const_iterator iter =
1887 directory->child_directories().begin();
1888 iter != directory->child_directories().end(); ++iter) {
1889 GDataEntryProto proto;
1890 static_cast<const GDataEntry*>(iter->second)->ToProtoFull(&proto);
1891 entries->push_back(proto);
1892 }
1893 1879
1894 if (!callback.is_null()) 1880 if (!callback.is_null())
1895 callback.Run(GDATA_FILE_OK, entries.Pass()); 1881 callback.Run(GDATA_FILE_OK, entries.Pass());
1896 } 1882 }
1897 1883
1898 void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) { 1884 void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) {
1899 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || 1885 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
1900 BrowserThread::CurrentlyOn(BrowserThread::IO)); 1886 BrowserThread::CurrentlyOn(BrowserThread::IO));
1901 RunTaskOnUIThread( 1887 RunTaskOnUIThread(
1902 base::Bind(&GDataFileSystem::RequestDirectoryRefreshOnUIThread, 1888 base::Bind(&GDataFileSystem::RequestDirectoryRefreshOnUIThread,
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3415 } 3401 }
3416 3402
3417 PlatformFileInfoProto entry_file_info; 3403 PlatformFileInfoProto entry_file_info;
3418 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 3404 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
3419 *entry_proto->mutable_file_info() = entry_file_info; 3405 *entry_proto->mutable_file_info() = entry_file_info;
3420 if (!callback.is_null()) 3406 if (!callback.is_null())
3421 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); 3407 callback.Run(GDATA_FILE_OK, entry_proto.Pass());
3422 } 3408 }
3423 3409
3424 } // namespace gdata 3410 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698