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

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

Issue 10829375: Cleanup: separate WAPI and Drive API code in gdata_documents_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for 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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/platform_file.h" 16 #include "base/platform_file.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/chromeos/gdata/documents_service_interface.h"
19 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" 20 #include "chrome/browser/chromeos/gdata/drive_api_parser.h"
20 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 21 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
21 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 22 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
22 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
24 #include "chrome/browser/chromeos/gdata/gdata_files.h" 24 #include "chrome/browser/chromeos/gdata/gdata_files.h"
25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" 25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h"
26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
28 #include "chrome/browser/chromeos/gdata/gdata_util.h" 28 #include "chrome/browser/chromeos/gdata/gdata_util.h"
29 #include "chrome/browser/chromeos/gdata/task_util.h" 29 #include "chrome/browser/chromeos/gdata/task_util.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 RunTaskOnUIThread(base::Bind(&GDataFileSystem::GetAvailableSpaceOnUIThread, 2099 RunTaskOnUIThread(base::Bind(&GDataFileSystem::GetAvailableSpaceOnUIThread,
2100 ui_weak_ptr_, 2100 ui_weak_ptr_,
2101 CreateRelayCallback(callback))); 2101 CreateRelayCallback(callback)));
2102 } 2102 }
2103 2103
2104 void GDataFileSystem::GetAvailableSpaceOnUIThread( 2104 void GDataFileSystem::GetAvailableSpaceOnUIThread(
2105 const GetAvailableSpaceCallback& callback) { 2105 const GetAvailableSpaceCallback& callback) {
2106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2107 DCHECK(!callback.is_null()); 2107 DCHECK(!callback.is_null());
2108 2108
2109 if (gdata::util::IsDriveV2ApiEnabled()) { 2109 documents_service_->GetAccountMetadata(
2110 documents_service_->GetAboutResource( 2110 gdata::util::IsDriveV2ApiEnabled() ?
2111 base::Bind(&GDataFileSystem::OnGetAboutResource, 2111 base::Bind(&GDataFileSystem::OnGetAboutResource,
2112 ui_weak_ptr_, 2112 ui_weak_ptr_,
2113 callback)); 2113 callback) :
2114 return;
2115 }
2116
2117 documents_service_->GetAccountMetadata(
2118 base::Bind(&GDataFileSystem::OnGetAvailableSpace, 2114 base::Bind(&GDataFileSystem::OnGetAvailableSpace,
2119 ui_weak_ptr_, 2115 ui_weak_ptr_,
2120 callback)); 2116 callback));
2121 } 2117 }
2122 2118
2123 void GDataFileSystem::OnGetAvailableSpace( 2119 void GDataFileSystem::OnGetAvailableSpace(
2124 const GetAvailableSpaceCallback& callback, 2120 const GetAvailableSpaceCallback& callback,
2125 GDataErrorCode status, 2121 GDataErrorCode status,
2126 scoped_ptr<base::Value> data) { 2122 scoped_ptr<base::Value> data) {
2127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 return; 3303 return;
3308 } 3304 }
3309 3305
3310 PlatformFileInfoProto entry_file_info; 3306 PlatformFileInfoProto entry_file_info;
3311 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 3307 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
3312 *entry_proto->mutable_file_info() = entry_file_info; 3308 *entry_proto->mutable_file_info() = entry_file_info;
3313 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); 3309 callback.Run(GDATA_FILE_OK, entry_proto.Pass());
3314 } 3310 }
3315 3311
3316 } // namespace gdata 3312 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_download_observer.cc ('k') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698