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 #include "chrome/browser/chromeos/gdata/drive_task_executor.h" | 5 #include "chrome/browser/chromeos/gdata/drive_task_executor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 for (std::vector<FilePath>::const_iterator iter = raw_paths.begin(); | 72 for (std::vector<FilePath>::const_iterator iter = raw_paths.begin(); |
73 iter != raw_paths.end(); ++iter) { | 73 iter != raw_paths.end(); ++iter) { |
74 file_system->GetEntryInfoByPath( | 74 file_system->GetEntryInfoByPath( |
75 *iter, | 75 *iter, |
76 base::Bind(&DriveTaskExecutor::OnFileEntryFetched, this)); | 76 base::Bind(&DriveTaskExecutor::OnFileEntryFetched, this)); |
77 } | 77 } |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 void DriveTaskExecutor::OnFileEntryFetched( | 81 void DriveTaskExecutor::OnFileEntryFetched( |
82 GDataFileError error, | 82 DriveFileError error, |
83 scoped_ptr<DriveEntryProto> entry_proto) { | 83 scoped_ptr<DriveEntryProto> entry_proto) { |
84 // If we aborted, then this will be zero. | 84 // If we aborted, then this will be zero. |
85 if (!current_index_) | 85 if (!current_index_) |
86 return; | 86 return; |
87 | 87 |
88 GDataSystemService* system_service = | 88 GDataSystemService* system_service = |
89 GDataSystemServiceFactory::GetForProfile(profile()); | 89 GDataSystemServiceFactory::GetForProfile(profile()); |
90 | 90 |
91 // Here, we are only insterested in files. | 91 // Here, we are only insterested in files. |
92 if (entry_proto.get() && !entry_proto->has_file_specific_info()) | 92 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
93 error = GDATA_FILE_ERROR_NOT_FOUND; | 93 error = DRIVE_FILE_ERROR_NOT_FOUND; |
94 | 94 |
95 if (!system_service || error != GDATA_FILE_OK) { | 95 if (!system_service || error != DRIVE_FILE_OK) { |
96 Done(false); | 96 Done(false); |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 DriveServiceInterface* drive_service = | 100 DriveServiceInterface* drive_service = |
101 system_service->drive_service(); | 101 system_service->drive_service(); |
102 | 102 |
103 // Send off a request for the drive service to authorize the apps for the | 103 // Send off a request for the drive service to authorize the apps for the |
104 // current document entry for this document so we can get the | 104 // current document entry for this document so we can get the |
105 // open-with-<app_id> urls from the document entry. | 105 // open-with-<app_id> urls from the document entry. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 void DriveTaskExecutor::Done(bool success) { | 168 void DriveTaskExecutor::Done(bool success) { |
169 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 169 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
170 current_index_ = 0; | 170 current_index_ = 0; |
171 if (!done_.is_null()) | 171 if (!done_.is_null()) |
172 done_.Run(success); | 172 done_.Run(success); |
173 done_.Reset(); | 173 done_.Reset(); |
174 } | 174 } |
175 | 175 |
176 } // namespace gdata | 176 } // namespace gdata |
OLD | NEW |