| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" | 12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| 13 #include "chrome/browser/chromeos/gdata/drive.pb.h" |
| 13 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 14 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/browser_tabstrip.h" | 20 #include "chrome/browser/ui/browser_tabstrip.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "webkit/fileapi/file_system_types.h" | 23 #include "webkit/fileapi/file_system_types.h" |
| 24 #include "webkit/fileapi/file_system_util.h" | 24 #include "webkit/fileapi/file_system_util.h" |
| 25 | 25 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 iter != raw_paths.end(); ++iter) { | 75 iter != raw_paths.end(); ++iter) { |
| 76 file_system->GetEntryInfoByPath( | 76 file_system->GetEntryInfoByPath( |
| 77 *iter, | 77 *iter, |
| 78 base::Bind(&DriveTaskExecutor::OnFileEntryFetched, this)); | 78 base::Bind(&DriveTaskExecutor::OnFileEntryFetched, this)); |
| 79 } | 79 } |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void DriveTaskExecutor::OnFileEntryFetched( | 83 void DriveTaskExecutor::OnFileEntryFetched( |
| 84 GDataFileError error, | 84 GDataFileError error, |
| 85 scoped_ptr<GDataEntryProto> entry_proto) { | 85 scoped_ptr<DriveEntryProto> entry_proto) { |
| 86 // If we aborted, then this will be zero. | 86 // If we aborted, then this will be zero. |
| 87 if (!current_index_) | 87 if (!current_index_) |
| 88 return; | 88 return; |
| 89 | 89 |
| 90 GDataSystemService* system_service = | 90 GDataSystemService* system_service = |
| 91 GDataSystemServiceFactory::GetForProfile(profile()); | 91 GDataSystemServiceFactory::GetForProfile(profile()); |
| 92 | 92 |
| 93 // Here, we are only insterested in files. | 93 // Here, we are only insterested in files. |
| 94 if (entry_proto.get() && !entry_proto->has_file_specific_info()) | 94 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
| 95 error = GDATA_FILE_ERROR_NOT_FOUND; | 95 error = GDATA_FILE_ERROR_NOT_FOUND; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void DriveTaskExecutor::Done(bool success) { | 170 void DriveTaskExecutor::Done(bool success) { |
| 171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 172 current_index_ = 0; | 172 current_index_ = 0; |
| 173 if (!done_.is_null()) | 173 if (!done_.is_null()) |
| 174 done_.Run(success); | 174 done_.Run(success); |
| 175 done_.Reset(); | 175 done_.Reset(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace gdata | 178 } // namespace gdata |
| OLD | NEW |