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_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/sync_file_system/sync_callbacks.h"
11 #include "chrome/browser/sync_file_system/sync_task.h"
12 #include "google_apis/drive/gdata_errorcode.h"
15 class DriveServiceInterface
;
18 namespace google_apis
{
23 namespace sync_file_system
{
24 namespace drive_backend
{
28 class MetadataDatabase
;
29 class SyncEngineContext
;
32 class RegisterAppTask
: public SyncTask
{
34 RegisterAppTask(SyncEngineContext
* sync_context
, const std::string
& app_id
);
35 virtual ~RegisterAppTask();
37 virtual void Run(const SyncStatusCallback
& callback
) OVERRIDE
;
40 void CreateAppRootFolder(const SyncStatusCallback
& callback
);
41 void DidCreateAppRootFolder(const SyncStatusCallback
& callback
,
42 const std::string
& file_id
,
43 SyncStatusCode status
);
44 bool FilterCandidates(const TrackerSet
& trackers
,
45 FileTracker
* candidate
);
46 void RegisterAppIntoDatabase(const FileTracker
& tracker
,
47 const SyncStatusCallback
& callback
);
49 MetadataDatabase
* metadata_database();
50 drive::DriveServiceInterface
* drive_service();
52 SyncEngineContext
* sync_context_
; // Not owned.
54 int create_folder_retry_count_
;
57 scoped_ptr
<FolderCreator
> folder_creator_
;
59 base::WeakPtrFactory
<RegisterAppTask
> weak_ptr_factory_
;
61 DISALLOW_COPY_AND_ASSIGN(RegisterAppTask
);
64 } // namespace drive_backend
65 } // namespace sync_file_system
67 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REGISTER_APP_TASK_H_