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

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system.cc

Issue 14118006: Change owner of DriveScheduler from DriveFileSystem to DriveSystemService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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/drive/drive_file_system.h" 5 #include "chrome/browser/chromeos/drive/drive_file_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 std::string md5; 204 std::string md5;
205 }; 205 };
206 206
207 207
208 // DriveFileSystem class implementation. 208 // DriveFileSystem class implementation.
209 209
210 DriveFileSystem::DriveFileSystem( 210 DriveFileSystem::DriveFileSystem(
211 Profile* profile, 211 Profile* profile,
212 DriveCache* cache, 212 DriveCache* cache,
213 google_apis::DriveServiceInterface* drive_service, 213 google_apis::DriveServiceInterface* drive_service,
214 DriveScheduler* scheduler,
214 DriveWebAppsRegistry* webapps_registry, 215 DriveWebAppsRegistry* webapps_registry,
215 DriveResourceMetadata* resource_metadata, 216 DriveResourceMetadata* resource_metadata,
216 base::SequencedTaskRunner* blocking_task_runner) 217 base::SequencedTaskRunner* blocking_task_runner)
217 : profile_(profile), 218 : profile_(profile),
218 cache_(cache), 219 cache_(cache),
219 drive_service_(drive_service), 220 drive_service_(drive_service),
221 scheduler_(scheduler),
220 webapps_registry_(webapps_registry), 222 webapps_registry_(webapps_registry),
221 resource_metadata_(resource_metadata), 223 resource_metadata_(resource_metadata),
222 last_update_check_error_(DRIVE_FILE_OK), 224 last_update_check_error_(DRIVE_FILE_OK),
223 hide_hosted_docs_(false), 225 hide_hosted_docs_(false),
224 blocking_task_runner_(blocking_task_runner), 226 blocking_task_runner_(blocking_task_runner),
225 scheduler_(new DriveScheduler(profile, drive_service)),
226 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 227 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
227 // Should be created from the file browser extension API on UI thread. 228 // Should be created from the file browser extension API on UI thread.
228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
229 } 230 }
230 231
231 void DriveFileSystem::Reload() { 232 void DriveFileSystem::Reload() {
232 resource_metadata_->Reset(base::Bind(&DriveFileSystem::ReloadAfterReset, 233 resource_metadata_->Reset(base::Bind(&DriveFileSystem::ReloadAfterReset,
233 weak_ptr_factory_.GetWeakPtr())); 234 weak_ptr_factory_.GetWeakPtr()));
234 } 235 }
235 236
236 void DriveFileSystem::Initialize() { 237 void DriveFileSystem::Initialize() {
237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
238 239
239 SetupChangeListLoader(); 240 SetupChangeListLoader();
240 241
241 // Allocate the drive operation handlers. 242 // Allocate the drive operation handlers.
242 drive_operations_.Init(scheduler_.get(), 243 drive_operations_.Init(scheduler_,
243 this, // DriveFileSystemInterface 244 this, // DriveFileSystemInterface
244 cache_, 245 cache_,
245 resource_metadata_, 246 resource_metadata_,
246 blocking_task_runner_, 247 blocking_task_runner_,
247 this); // OperationObserver 248 this); // OperationObserver
248 249
249 PrefService* pref_service = profile_->GetPrefs(); 250 PrefService* pref_service = profile_->GetPrefs();
250 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); 251 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles);
251 252
252 scheduler_->Initialize();
253
254 InitializePreferenceObserver(); 253 InitializePreferenceObserver();
255 } 254 }
256 255
257 void DriveFileSystem::ReloadAfterReset() { 256 void DriveFileSystem::ReloadAfterReset() {
258 SetupChangeListLoader(); 257 SetupChangeListLoader();
259 258
260 change_list_loader_->LoadIfNeeded( 259 change_list_loader_->LoadIfNeeded(
261 DirectoryFetchInfo(), 260 DirectoryFetchInfo(),
262 base::Bind(&DriveFileSystem::OnUpdateChecked, 261 base::Bind(&DriveFileSystem::OnUpdateChecked,
263 weak_ptr_factory_.GetWeakPtr())); 262 weak_ptr_factory_.GetWeakPtr()));
264 } 263 }
265 264
266 void DriveFileSystem::SetupChangeListLoader() { 265 void DriveFileSystem::SetupChangeListLoader() {
267 change_list_loader_.reset(new ChangeListLoader(resource_metadata_, 266 change_list_loader_.reset(new ChangeListLoader(resource_metadata_,
268 scheduler_.get(), 267 scheduler_,
269 webapps_registry_)); 268 webapps_registry_));
270 change_list_loader_->AddObserver(this); 269 change_list_loader_->AddObserver(this);
271 } 270 }
272 271
273 void DriveFileSystem::CheckForUpdates() { 272 void DriveFileSystem::CheckForUpdates() {
274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
275 DVLOG(1) << "CheckForUpdates"; 274 DVLOG(1) << "CheckForUpdates";
276 275
277 if (change_list_loader_) { 276 if (change_list_loader_) {
278 change_list_loader_->CheckForUpdates( 277 change_list_loader_->CheckForUpdates(
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 return; 1683 return;
1685 } 1684 }
1686 1685
1687 PlatformFileInfoProto entry_file_info; 1686 PlatformFileInfoProto entry_file_info;
1688 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 1687 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
1689 *entry_proto->mutable_file_info() = entry_file_info; 1688 *entry_proto->mutable_file_info() = entry_file_info;
1690 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); 1689 callback.Run(DRIVE_FILE_OK, entry_proto.Pass());
1691 } 1690 }
1692 1691
1693 } // namespace drive 1692 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.h ('k') | chrome/browser/chromeos/drive/drive_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698