BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / folder_creator.h
blob2bce1761a29c9a80b0366d9c95b4e87e27ef9f37
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 <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/sync_file_system/sync_callbacks.h"
14 #include "google_apis/drive/drive_api_error_codes.h"
16 namespace drive {
17 class DriveServiceInterface;
20 namespace google_apis {
21 class FileList;
22 class FileResource;
25 namespace sync_file_system {
26 namespace drive_backend {
28 class MetadataDatabase;
29 class SyncEngineContext;
31 class FolderCreator {
32 public:
33 typedef base::Callback<void(const std::string& file_id,
34 SyncStatusCode status)> FileIDCallback;
36 FolderCreator(drive::DriveServiceInterface* drive_service,
37 MetadataDatabase* metadata_database,
38 const std::string& parent_folder_id,
39 const std::string& title);
40 ~FolderCreator();
42 void Run(const FileIDCallback& callback);
44 private:
45 void DidCreateFolder(const FileIDCallback& callback,
46 google_apis::DriveApiErrorCode error,
47 scoped_ptr<google_apis::FileResource> entry);
48 void DidListFolders(const FileIDCallback& callback,
49 ScopedVector<google_apis::FileResource> candidates,
50 google_apis::DriveApiErrorCode error,
51 scoped_ptr<google_apis::FileList> file_list);
53 drive::DriveServiceInterface* drive_service_;
54 MetadataDatabase* metadata_database_;
56 const std::string parent_folder_id_;
57 const std::string title_;
59 base::WeakPtrFactory<FolderCreator> weak_ptr_factory_;
61 DISALLOW_COPY_AND_ASSIGN(FolderCreator);
64 } // namespace drive_backend
65 } // namespace sync_file_system
67 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FOLDER_CREATOR_H_