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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_tasks.cc

Issue 101323002: Stop setting invalid value to the |tab_id| field of fileBrowserHandler API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 (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/file_manager/file_tasks.h" 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
6 6
7 #include "apps/launcher.h" 7 #include "apps/launcher.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 task->app_id = result[0]; 259 task->app_id = result[0];
260 task->task_type = task_type; 260 task->task_type = task_type;
261 task->action_id = result[2]; 261 task->action_id = result[2];
262 262
263 return true; 263 return true;
264 } 264 }
265 265
266 bool ExecuteFileTask(Profile* profile, 266 bool ExecuteFileTask(Profile* profile,
267 const GURL& source_url, 267 const GURL& source_url,
268 const std::string& app_id, 268 const std::string& app_id,
269 int32 tab_id,
270 const TaskDescriptor& task, 269 const TaskDescriptor& task,
271 const std::vector<FileSystemURL>& file_urls, 270 const std::vector<FileSystemURL>& file_urls,
272 const FileTaskFinishedCallback& done) { 271 const FileTaskFinishedCallback& done) {
273 if (!FileBrowserHasAccessPermissionForFiles(profile, source_url, 272 if (!FileBrowserHasAccessPermissionForFiles(profile, source_url,
274 app_id, file_urls)) 273 app_id, file_urls))
275 return false; 274 return false;
276 275
277 // drive::FileTaskExecutor is responsible to handle drive tasks. 276 // drive::FileTaskExecutor is responsible to handle drive tasks.
278 if (task.task_type == TASK_TYPE_DRIVE_APP) { 277 if (task.task_type == TASK_TYPE_DRIVE_APP) {
279 DCHECK_EQ(kDriveAppActionID, task.action_id); 278 DCHECK_EQ(kDriveAppActionID, task.action_id);
280 drive::FileTaskExecutor* executor = 279 drive::FileTaskExecutor* executor =
281 new drive::FileTaskExecutor(profile, task.app_id); 280 new drive::FileTaskExecutor(profile, task.app_id);
282 executor->Execute(file_urls, done); 281 executor->Execute(file_urls, done);
283 return true; 282 return true;
284 } 283 }
285 284
286 // Get the extension. 285 // Get the extension.
287 ExtensionService* service = 286 ExtensionService* service =
288 extensions::ExtensionSystem::Get(profile)->extension_service(); 287 extensions::ExtensionSystem::Get(profile)->extension_service();
289 const Extension* extension = service ? 288 const Extension* extension = service ?
290 service->GetExtensionById(task.app_id, false) : NULL; 289 service->GetExtensionById(task.app_id, false) : NULL;
291 if (!extension) 290 if (!extension)
292 return false; 291 return false;
293 292
294 // Execute the task. 293 // Execute the task.
295 if (task.task_type == TASK_TYPE_FILE_BROWSER_HANDLER) { 294 if (task.task_type == TASK_TYPE_FILE_BROWSER_HANDLER) {
296 return file_browser_handlers::ExecuteFileBrowserHandler( 295 return file_browser_handlers::ExecuteFileBrowserHandler(
297 profile, 296 profile,
298 extension, 297 extension,
299 tab_id,
300 task.action_id, 298 task.action_id,
301 file_urls, 299 file_urls,
302 done); 300 done);
303 } else if (task.task_type == TASK_TYPE_FILE_HANDLER) { 301 } else if (task.task_type == TASK_TYPE_FILE_HANDLER) {
304 for (size_t i = 0; i != file_urls.size(); ++i) { 302 for (size_t i = 0; i != file_urls.size(); ++i) {
305 apps::LaunchPlatformAppWithFileHandler( 303 apps::LaunchPlatformAppWithFileHandler(
306 profile, extension, task.action_id, file_urls[i].path()); 304 profile, extension, task.action_id, file_urls[i].path());
307 } 305 }
308 306
309 if (!done.is_null()) 307 if (!done.is_null())
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 if (file_browser_handlers::IsFallbackFileBrowserHandler( 537 if (file_browser_handlers::IsFallbackFileBrowserHandler(
540 task->task_descriptor())) { 538 task->task_descriptor())) {
541 task->set_is_default(true); 539 task->set_is_default(true);
542 return; 540 return;
543 } 541 }
544 } 542 }
545 } 543 }
546 544
547 } // namespace file_tasks 545 } // namespace file_tasks
548 } // namespace file_manager 546 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_tasks.h ('k') | chrome/browser/chromeos/file_manager/open_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698