Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/file_manager/private_api_tasks.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 &mime_type); 80 &mime_type);
81 } 81 }
82 } 82 }
83 sniffed_path_mime_set.insert(std::make_pair(file_path, mime_type)); 83 sniffed_path_mime_set.insert(std::make_pair(file_path, mime_type));
84 } 84 }
85 path_mime_set->swap(sniffed_path_mime_set); 85 path_mime_set->swap(sniffed_path_mime_set);
86 } 86 }
87 87
88 } // namespace 88 } // namespace
89 89
90 bool FileBrowserPrivateExecuteTaskFunction::RunImpl() { 90 bool FileBrowserPrivateExecuteTaskFunction::RunAsync() {
91 using extensions::api::file_browser_private::ExecuteTask::Params; 91 using extensions::api::file_browser_private::ExecuteTask::Params;
92 using extensions::api::file_browser_private::ExecuteTask::Results::Create; 92 using extensions::api::file_browser_private::ExecuteTask::Results::Create;
93 const scoped_ptr<Params> params(Params::Create(*args_)); 93 const scoped_ptr<Params> params(Params::Create(*args_));
94 EXTENSION_FUNCTION_VALIDATE(params); 94 EXTENSION_FUNCTION_VALIDATE(params);
95 95
96 file_manager::file_tasks::TaskDescriptor task; 96 file_manager::file_tasks::TaskDescriptor task;
97 if (!file_manager::file_tasks::ParseTaskID(params->task_id, &task)) { 97 if (!file_manager::file_tasks::ParseTaskID(params->task_id, &task)) {
98 LOG(WARNING) << "Invalid task " << params->task_id; 98 LOG(WARNING) << "Invalid task " << params->task_id;
99 results_ = 99 results_ =
100 Create(extensions::api::file_browser_private::TASK_RESULT_FAILED); 100 Create(extensions::api::file_browser_private::TASK_RESULT_FAILED);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void FileBrowserPrivateExecuteTaskFunction::OnTaskExecuted( 140 void FileBrowserPrivateExecuteTaskFunction::OnTaskExecuted(
141 extensions::api::file_browser_private::TaskResult result) { 141 extensions::api::file_browser_private::TaskResult result) {
142 results_ = 142 results_ =
143 extensions::api::file_browser_private::ExecuteTask::Results::Create( 143 extensions::api::file_browser_private::ExecuteTask::Results::Create(
144 result); 144 result);
145 SendResponse(result != 145 SendResponse(result !=
146 extensions::api::file_browser_private::TASK_RESULT_FAILED); 146 extensions::api::file_browser_private::TASK_RESULT_FAILED);
147 } 147 }
148 148
149 bool FileBrowserPrivateGetFileTasksFunction::RunImpl() { 149 bool FileBrowserPrivateGetFileTasksFunction::RunAsync() {
150 using extensions::api::file_browser_private::GetFileTasks::Params; 150 using extensions::api::file_browser_private::GetFileTasks::Params;
151 const scoped_ptr<Params> params(Params::Create(*args_)); 151 const scoped_ptr<Params> params(Params::Create(*args_));
152 EXTENSION_FUNCTION_VALIDATE(params); 152 EXTENSION_FUNCTION_VALIDATE(params);
153 153
154 if (params->file_urls.empty()) 154 if (params->file_urls.empty())
155 return false; 155 return false;
156 156
157 // MIME types can either be empty, or there needs to be one for each file. 157 // MIME types can either be empty, or there needs to be one for each file.
158 if (params->mime_types.size() != params->file_urls.size() && 158 if (params->mime_types.size() != params->file_urls.size() &&
159 params->mime_types.size() != 0) 159 params->mime_types.size() != 0)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 SetResult(new base::FundamentalValue(true)); 264 SetResult(new base::FundamentalValue(true));
265 return true; 265 return true;
266 } 266 }
267 267
268 file_manager::file_tasks::UpdateDefaultTask( 268 file_manager::file_tasks::UpdateDefaultTask(
269 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); 269 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types);
270 return true; 270 return true;
271 } 271 }
272 272
273 } // namespace extensions 273 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698