Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / folder_creator.h
blobb032131f1d84db8e2db13b75b61a759faa9807ca
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_FOLDER_CREATOR_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FOLDER_CREATOR_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/sync_file_system/sync_callbacks.h"
12 #include "google_apis/drive/gdata_errorcode.h"
14 namespace drive {
15 class DriveServiceInterface;
18 namespace google_apis {
19 class ResourceEntry;
20 class ResourceList;
23 namespace sync_file_system {
24 namespace drive_backend {
26 class MetadataDatabase;
27 class SyncEngineContext;
29 class FolderCreator {
30 public:
31 typedef base::Callback<void(const std::string& file_id,
32 SyncStatusCode status)> FileIDCallback;
34 FolderCreator(drive::DriveServiceInterface* drive_service,
35 MetadataDatabase* metadata_database,
36 const std::string& parent_folder_id,
37 const std::string& title);
38 ~FolderCreator();
40 void Run(const FileIDCallback& callback);
42 private:
43 void DidCreateFolder(const FileIDCallback& callback,
44 google_apis::GDataErrorCode error,
45 scoped_ptr<google_apis::ResourceEntry> entry);
46 void DidListFolders(const FileIDCallback& callback,
47 ScopedVector<google_apis::ResourceEntry> candidates,
48 google_apis::GDataErrorCode error,
49 scoped_ptr<google_apis::ResourceList> resource_list);
50 void DidUpdateDatabase(const std::string& file_id,
51 const FileIDCallback& callback,
52 SyncStatusCode status);
54 drive::DriveServiceInterface* drive_service_;
55 MetadataDatabase* metadata_database_;
57 const std::string parent_folder_id_;
58 const std::string title_;
60 base::WeakPtrFactory<FolderCreator> weak_ptr_factory_;
62 DISALLOW_COPY_AND_ASSIGN(FolderCreator);
65 } // namespace drive_backend
66 } // namespace sync_file_system
68 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FOLDER_CREATOR_H_