Chromium Code Reviews| 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/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/drive_api_parser.h" | 19 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" |
| 20 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 20 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 21 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 21 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
| 22 #include "chrome/browser/chromeos/gdata/gdata_documents_service.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_protocol_handler.h" | 24 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" |
| 25 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 25 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 26 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 26 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 27 #include "chrome/browser/chromeos/gdata/stale_cache_files_remover.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/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 33 #include "net/base/mime_util.h" | 34 #include "net/base/mime_util.h" |
| 34 | 35 |
| 35 using content::BrowserThread; | 36 using content::BrowserThread; |
| 36 | 37 |
| (...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2809 const FindEntryCallback& callback, | 2810 const FindEntryCallback& callback, |
| 2810 GDataFileError error, | 2811 GDataFileError error, |
| 2811 GDataEntry* entry) { | 2812 GDataEntry* entry) { |
| 2812 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2813 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2813 | 2814 |
| 2814 if (!callback.is_null()) | 2815 if (!callback.is_null()) |
| 2815 callback.Run(error, entry); | 2816 callback.Run(error, entry); |
| 2816 | 2817 |
| 2817 DVLOG(1) << "RunAndNotifyInitialLoadFinished"; | 2818 DVLOG(1) << "RunAndNotifyInitialLoadFinished"; |
| 2818 | 2819 |
| 2820 // Removes stale cache files. This will delete itself after removing stale | |
| 2821 // cache files. | |
| 2822 StaleCacheFilesRemover* remover = new StaleCacheFilesRemover(this, cache_); | |
| 2823 remover->ScrubCacheAfterDelay(); | |
|
satorux1
2012/08/10 23:47:40
I think "scrub" is not a popular verb in code. Let
| |
| 2824 | |
| 2819 // Notify the observers that root directory has been initialized. | 2825 // Notify the observers that root directory has been initialized. |
| 2820 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_, | 2826 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_, |
| 2821 OnInitialLoadFinished()); | 2827 OnInitialLoadFinished()); |
| 2822 } | 2828 } |
| 2823 | 2829 |
| 2824 GDataFileError GDataFileSystem::AddNewDirectory( | 2830 GDataFileError GDataFileSystem::AddNewDirectory( |
| 2825 const FilePath& directory_path, base::Value* entry_value) { | 2831 const FilePath& directory_path, base::Value* entry_value) { |
| 2826 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2832 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2827 | 2833 |
| 2828 if (!entry_value) | 2834 if (!entry_value) |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3466 } | 3472 } |
| 3467 | 3473 |
| 3468 PlatformFileInfoProto entry_file_info; | 3474 PlatformFileInfoProto entry_file_info; |
| 3469 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 3475 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 3470 *entry_proto->mutable_file_info() = entry_file_info; | 3476 *entry_proto->mutable_file_info() = entry_file_info; |
| 3471 if (!callback.is_null()) | 3477 if (!callback.is_null()) |
| 3472 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); | 3478 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); |
| 3473 } | 3479 } |
| 3474 | 3480 |
| 3475 } // namespace gdata | 3481 } // namespace gdata |
| OLD | NEW |