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

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

Issue 391873003: Files.app: random code clean up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 (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_browser_handlers.h" 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/drive/file_system_util.h" 11 #include "chrome/browser/chromeos/drive/file_system_util.h"
12 #include "chrome/browser/chromeos/file_manager/app_id.h" 12 #include "chrome/browser/chromeos/file_manager/app_id.h"
13 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" 13 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
14 #include "chrome/browser/chromeos/file_manager/open_with_browser.h" 14 #include "chrome/browser/chromeos/file_manager/open_with_browser.h"
15 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" 15 #include "chrome/browser/chromeos/fileapi/file_system_backend.h"
16 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/extensions/extension_util.h" 17 #include "chrome/browser/extensions/extension_util.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle r.h" 20 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle r.h"
21 #include "chrome/common/extensions/api/file_browser_private.h" 21 #include "chrome/common/extensions/api/file_browser_private.h"
22 #include "chrome/common/extensions/extension_constants.h"
23 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/child_process_security_policy.h" 23 #include "content/public/browser/child_process_security_policy.h"
25 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
26 #include "content/public/browser/site_instance.h" 25 #include "content/public/browser/site_instance.h"
27 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
28 #include "extensions/browser/event_router.h" 27 #include "extensions/browser/event_router.h"
29 #include "extensions/browser/extension_host.h" 28 #include "extensions/browser/extension_host.h"
30 #include "extensions/browser/extension_system.h" 29 #include "extensions/browser/extension_system.h"
31 #include "extensions/browser/extension_util.h" 30 #include "extensions/browser/extension_util.h"
32 #include "extensions/browser/lazy_background_task_queue.h" 31 #include "extensions/browser/lazy_background_task_queue.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 done.Run(extensions::api::file_browser_private::TASK_RESULT_OPENED); 477 done.Run(extensions::api::file_browser_private::TASK_RESULT_OPENED);
479 return result; 478 return result;
480 } 479 }
481 480
482 // The executor object will be self deleted on completion. 481 // The executor object will be self deleted on completion.
483 (new FileBrowserHandlerExecutor( 482 (new FileBrowserHandlerExecutor(
484 profile, extension, action_id))->Execute(file_urls, done); 483 profile, extension, action_id))->Execute(file_urls, done);
485 return true; 484 return true;
486 } 485 }
487 486
488 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task) {
489 return ((task.task_type == file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER ||
490 task.task_type == file_tasks::TASK_TYPE_FILE_HANDLER) &&
491 (task.app_id == kFileManagerAppId ||
492 task.app_id == kVideoPlayerAppId ||
493 task.app_id == kGalleryAppId ||
494 task.app_id == extension_misc::kQuickOfficeComponentExtensionId ||
495 task.app_id == extension_misc::kQuickOfficeInternalExtensionId ||
496 task.app_id == extension_misc::kQuickOfficeExtensionId));
497 }
498
499 FileBrowserHandlerList FindFileBrowserHandlers( 487 FileBrowserHandlerList FindFileBrowserHandlers(
500 Profile* profile, 488 Profile* profile,
501 const std::vector<GURL>& file_list) { 489 const std::vector<GURL>& file_list) {
502 FileBrowserHandlerList common_handlers; 490 FileBrowserHandlerList common_handlers;
503 for (std::vector<GURL>::const_iterator it = file_list.begin(); 491 for (std::vector<GURL>::const_iterator it = file_list.begin();
504 it != file_list.end(); ++it) { 492 it != file_list.end(); ++it) {
505 FileBrowserHandlerList handlers = 493 FileBrowserHandlerList handlers =
506 FindFileBrowserHandlersForURL(profile, *it); 494 FindFileBrowserHandlersForURL(profile, *it);
507 // If there is nothing to do for one file, the intersection of handlers 495 // If there is nothing to do for one file, the intersection of handlers
508 // for all files will be empty at the end, so no need to check further. 496 // for all files will be empty at the end, so no need to check further.
(...skipping 20 matching lines...) Expand all
529 if (common_handlers.empty()) 517 if (common_handlers.empty())
530 return FileBrowserHandlerList(); 518 return FileBrowserHandlerList();
531 } 519 }
532 } 520 }
533 521
534 return common_handlers; 522 return common_handlers;
535 } 523 }
536 524
537 } // namespace file_browser_handlers 525 } // namespace file_browser_handlers
538 } // namespace file_manager 526 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_browser_handlers.h ('k') | chrome/browser/chromeos/file_manager/file_tasks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698