OLD | NEW |
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_system_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/drive/drive_api_service.h" | 10 #include "chrome/browser/chromeos/drive/drive_api_service.h" |
10 #include "chrome/browser/chromeos/drive/drive_download_observer.h" | 11 #include "chrome/browser/chromeos/drive/drive_download_observer.h" |
11 #include "chrome/browser/chromeos/drive/drive_file_system.h" | 12 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
12 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" | 13 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" |
13 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
14 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" | 15 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" |
15 #include "chrome/browser/chromeos/drive/drive_sync_client.h" | 16 #include "chrome/browser/chromeos/drive/drive_sync_client.h" |
16 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 17 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
17 #include "chrome/browser/chromeos/drive/event_logger.h" | 18 #include "chrome/browser/chromeos/drive/event_logger.h" |
18 #include "chrome/browser/chromeos/drive/file_write_helper.h" | 19 #include "chrome/browser/chromeos/drive/file_write_helper.h" |
19 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" | 20 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" |
20 #include "chrome/browser/download/download_service.h" | 21 #include "chrome/browser/download/download_service.h" |
21 #include "chrome/browser/download/download_service_factory.h" | 22 #include "chrome/browser/download/download_service_factory.h" |
22 #include "chrome/browser/download/download_util.h" | 23 #include "chrome/browser/download/download_util.h" |
23 #include "chrome/browser/google_apis/drive_api_util.h" | 24 #include "chrome/browser/google_apis/drive_api_util.h" |
24 #include "chrome/browser/google_apis/drive_uploader.h" | 25 #include "chrome/browser/google_apis/drive_uploader.h" |
25 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 26 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
26 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 27 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
27 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
28 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/profiles/profile_dependency_manager.h" | 30 #include "chrome/browser/profiles/profile_dependency_manager.h" |
30 #include "chrome/browser/sync/profile_sync_service.h" | 31 #include "chrome/browser/sync/profile_sync_service.h" |
31 #include "chrome/browser/sync/profile_sync_service_factory.h" | 32 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 33 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
33 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
34 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
35 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/storage_partition.h" | 38 #include "content/public/browser/storage_partition.h" |
37 #include "google/cacheinvalidation/types.pb.h" | 39 #include "google/cacheinvalidation/types.pb.h" |
38 #include "webkit/fileapi/file_system_context.h" | 40 #include "webkit/fileapi/file_system_context.h" |
39 #include "webkit/fileapi/file_system_mount_point_provider.h" | 41 #include "webkit/fileapi/file_system_mount_point_provider.h" |
40 #include "webkit/user_agent/user_agent_util.h" | 42 #include "webkit/user_agent/user_agent_util.h" |
41 | 43 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 kDriveInvalidationObjectId)); | 318 kDriveInvalidationObjectId)); |
317 profile_sync_service->UpdateRegisteredInvalidationIds(this, ids); | 319 profile_sync_service->UpdateRegisteredInvalidationIds(this, ids); |
318 push_notification_registered_ = true; | 320 push_notification_registered_ = true; |
319 file_system_->SetPushNotificationEnabled( | 321 file_system_->SetPushNotificationEnabled( |
320 profile_sync_service->GetInvalidatorState() == | 322 profile_sync_service->GetInvalidatorState() == |
321 syncer::INVALIDATIONS_ENABLED); | 323 syncer::INVALIDATIONS_ENABLED); |
322 } | 324 } |
323 | 325 |
324 AddDriveMountPoint(); | 326 AddDriveMountPoint(); |
325 | 327 |
326 // Start prefetching of Drive metadata. | 328 if (CommandLine::ForCurrentProcess()->HasSwitch( |
327 file_system_->StartInitialFeedFetch(); | 329 switches::kEnableDriveMetadataPrefetch)) { |
| 330 // Start prefetching of Drive metadata. |
| 331 file_system_->StartInitialFeedFetch(); |
| 332 } |
328 } | 333 } |
329 | 334 |
330 void DriveSystemService::DisableDrive() { | 335 void DriveSystemService::DisableDrive() { |
331 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
332 | 337 |
333 drive_disabled_ = true; | 338 drive_disabled_ = true; |
334 // Change the download directory to the default value if the download | 339 // Change the download directory to the default value if the download |
335 // destination is set to under Drive mount point. | 340 // destination is set to under Drive mount point. |
336 PrefService* pref_service = profile_->GetPrefs(); | 341 PrefService* pref_service = profile_->GetPrefs(); |
337 if (util::IsUnderDriveMountPoint( | 342 if (util::IsUnderDriveMountPoint( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 if (factory_for_test_.is_null()) | 409 if (factory_for_test_.is_null()) |
405 service = new DriveSystemService(profile, NULL, FilePath(), NULL); | 410 service = new DriveSystemService(profile, NULL, FilePath(), NULL); |
406 else | 411 else |
407 service = factory_for_test_.Run(profile); | 412 service = factory_for_test_.Run(profile); |
408 | 413 |
409 service->Initialize(); | 414 service->Initialize(); |
410 return service; | 415 return service; |
411 } | 416 } |
412 | 417 |
413 } // namespace drive | 418 } // namespace drive |
OLD | NEW |