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