1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REGISTER_APP_TASK_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REGISTER_APP_TASK_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
13 #include "chrome/browser/sync_file_system/sync_callbacks.h"
14 #include "google_apis/drive/drive_api_error_codes.h"
17 class DriveServiceInterface
;
20 namespace sync_file_system
{
21 namespace drive_backend
{
25 class MetadataDatabase
;
26 class SyncEngineContext
;
29 class RegisterAppTask
: public ExclusiveTask
{
31 RegisterAppTask(SyncEngineContext
* sync_context
, const std::string
& app_id
);
32 ~RegisterAppTask() override
;
34 bool CanFinishImmediately();
35 void RunExclusive(const SyncStatusCallback
& callback
) override
;
38 void CreateAppRootFolder(const SyncStatusCallback
& callback
);
39 void DidCreateAppRootFolder(const SyncStatusCallback
& callback
,
40 const std::string
& file_id
,
41 SyncStatusCode status
);
42 bool FilterCandidates(const TrackerIDSet
& trackers
,
43 FileTracker
* candidate
);
44 void RegisterAppIntoDatabase(const FileTracker
& tracker
,
45 const SyncStatusCallback
& callback
);
47 MetadataDatabase
* metadata_database();
48 drive::DriveServiceInterface
* drive_service();
50 SyncEngineContext
* sync_context_
; // Not owned.
52 int create_folder_retry_count_
;
55 scoped_ptr
<FolderCreator
> folder_creator_
;
57 base::WeakPtrFactory
<RegisterAppTask
> weak_ptr_factory_
;
59 DISALLOW_COPY_AND_ASSIGN(RegisterAppTask
);
62 } // namespace drive_backend
63 } // namespace sync_file_system
65 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REGISTER_APP_TASK_H_