| 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 18 matching lines...) Expand all Loading... |
| 29 using file_handler_util::FileTaskExecutor; | 29 using file_handler_util::FileTaskExecutor; |
| 30 | 30 |
| 31 DriveTaskExecutor::DriveTaskExecutor(Profile* profile, | 31 DriveTaskExecutor::DriveTaskExecutor(Profile* profile, |
| 32 const std::string& app_id, | 32 const std::string& app_id, |
| 33 const std::string& action_id) | 33 const std::string& action_id) |
| 34 : file_handler_util::FileTaskExecutor(profile), | 34 : file_handler_util::FileTaskExecutor(profile), |
| 35 app_id_(app_id), | 35 app_id_(app_id), |
| 36 action_id_(action_id), | 36 action_id_(action_id), |
| 37 current_index_(0) { | 37 current_index_(0) { |
| 38 DCHECK("open-with" == action_id_); | 38 DCHECK("open-with" == action_id_); |
| 39 DCHECK(app_id.size() > FileTaskExecutor::kDriveTaskExtensionPrefixLength); | |
| 40 DCHECK(StartsWithASCII(app_id, | |
| 41 FileTaskExecutor::kDriveTaskExtensionPrefix, | |
| 42 false)); | |
| 43 // Strip off the prefix from the extension ID so we convert it to an app id. | |
| 44 app_id_ = app_id_.substr(FileTaskExecutor::kDriveTaskExtensionPrefixLength); | |
| 45 } | 39 } |
| 46 | 40 |
| 47 DriveTaskExecutor::~DriveTaskExecutor() { | 41 DriveTaskExecutor::~DriveTaskExecutor() { |
| 48 } | 42 } |
| 49 | 43 |
| 50 bool DriveTaskExecutor::ExecuteAndNotify( | 44 bool DriveTaskExecutor::ExecuteAndNotify( |
| 51 const std::vector<GURL>& file_urls, | 45 const std::vector<GURL>& file_urls, |
| 52 const file_handler_util::FileTaskFinishedCallback& done) { | 46 const file_handler_util::FileTaskFinishedCallback& done) { |
| 53 std::vector<FilePath> raw_paths; | 47 std::vector<FilePath> raw_paths; |
| 54 for (std::vector<GURL>::const_iterator iter = file_urls.begin(); | 48 for (std::vector<GURL>::const_iterator iter = file_urls.begin(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 161 |
| 168 void DriveTaskExecutor::Done(bool success) { | 162 void DriveTaskExecutor::Done(bool success) { |
| 169 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 163 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 170 current_index_ = 0; | 164 current_index_ = 0; |
| 171 if (!done_.is_null()) | 165 if (!done_.is_null()) |
| 172 done_.Run(success); | 166 done_.Run(success); |
| 173 done_.Reset(); | 167 done_.Reset(); |
| 174 } | 168 } |
| 175 | 169 |
| 176 } // namespace gdata | 170 } // namespace gdata |
| OLD | NEW |