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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/chromeos/drive/drive_file_error.h" | 11 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
12 #include "chrome/browser/chromeos/extensions/file_handler_util.h" | 12 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
13 #include "chrome/browser/google_apis/gdata_errorcode.h" | 13 #include "chrome/browser/google_apis/gdata_errorcode.h" |
14 | 14 |
15 namespace drive { | 15 namespace drive { |
16 | 16 |
17 class DriveEntryProto; | 17 class DriveEntryProto; |
18 | 18 |
19 // This class implements an "executor" class that will execute tasks for | 19 // This class implements an "executor" class that will execute tasks for |
20 // third party Drive apps that store data in Drive itself. To do that, it | 20 // third party Drive apps that store data in Drive itself. To do that, it |
21 // needs to find the file resource IDs and pass them to a server-side function | 21 // needs to find the file resource IDs and pass them to a server-side function |
22 // that will authorize the app to open the given document and return a URL | 22 // that will authorize the app to open the given document and return a URL |
23 // for opening the document in that app directly. | 23 // for opening the document in that app directly. |
24 class DriveTaskExecutor : public file_handler_util::FileTaskExecutor { | 24 class DriveTaskExecutor : public file_handler_util::FileTaskExecutor { |
25 public: | 25 public: |
26 // FileTaskExecutor overrides | 26 // FileTaskExecutor overrides |
27 virtual bool ExecuteAndNotify( | 27 virtual bool ExecuteAndNotify( |
28 const std::vector<GURL>& file_urls, | 28 const std::vector<fileapi::FileSystemURL>& file_urls, |
29 const file_handler_util::FileTaskFinishedCallback& done) OVERRIDE; | 29 const file_handler_util::FileTaskFinishedCallback& done) OVERRIDE; |
30 | 30 |
31 private: | 31 private: |
32 // FileTaskExecutor is the only class allowed to create one. | 32 // FileTaskExecutor is the only class allowed to create one. |
33 friend class file_handler_util::FileTaskExecutor; | 33 friend class file_handler_util::FileTaskExecutor; |
34 | 34 |
35 DriveTaskExecutor(Profile* profile, | 35 DriveTaskExecutor(Profile* profile, |
36 const std::string& app_id, | 36 const std::string& app_id, |
37 const std::string& action_id); | 37 const std::string& action_id); |
38 virtual ~DriveTaskExecutor(); | 38 virtual ~DriveTaskExecutor(); |
39 | 39 |
40 void OnFileEntryFetched(DriveFileError error, | 40 void OnFileEntryFetched(DriveFileError error, |
41 scoped_ptr<DriveEntryProto> entry_proto); | 41 scoped_ptr<DriveEntryProto> entry_proto); |
42 void OnAppAuthorized(const std::string& resource_id, | 42 void OnAppAuthorized(const std::string& resource_id, |
43 google_apis::GDataErrorCode error, | 43 google_apis::GDataErrorCode error, |
44 const GURL& open_link); | 44 const GURL& open_link); |
45 | 45 |
46 // Calls |done_| with |success| status. | 46 // Calls |done_| with |success| status. |
47 void Done(bool success); | 47 void Done(bool success); |
48 | 48 |
49 const GURL source_url_; | 49 const GURL source_url_; |
50 const std::string action_id_; | 50 const std::string action_id_; |
51 int current_index_; | 51 int current_index_; |
52 file_handler_util::FileTaskFinishedCallback done_; | 52 file_handler_util::FileTaskFinishedCallback done_; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace drive | 55 } // namespace drive |
56 | 56 |
57 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ | 57 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ |
OLD | NEW |