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/extensions/file_manager/file_tasks.h" | 5 #include "chrome/browser/chromeos/extensions/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" |
11 #include "chrome/browser/chromeos/drive/drive_app_registry.h" | 11 #include "chrome/browser/chromeos/drive/drive_app_registry.h" |
12 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 12 #include "chrome/browser/chromeos/drive/file_system_util.h" |
13 #include "chrome/browser/chromeos/drive/file_task_executor.h" | 13 #include "chrome/browser/chromeos/drive/file_task_executor.h" |
14 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handlers.
h" | 14 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handlers.
h" |
15 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" |
16 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" |
17 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 17 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
18 #include "chrome/browser/extensions/extension_host.h" | 18 #include "chrome/browser/extensions/extension_host.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/extensions/extension_system.h" | 21 #include "chrome/browser/extensions/extension_system.h" |
22 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if (google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( | 479 if (google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( |
480 iter->first) & | 480 iter->first) & |
481 google_apis::ResourceEntry::KIND_OF_GOOGLE_DOCUMENT) { | 481 google_apis::ResourceEntry::KIND_OF_GOOGLE_DOCUMENT) { |
482 has_google_document = true; | 482 has_google_document = true; |
483 break; | 483 break; |
484 } | 484 } |
485 } | 485 } |
486 | 486 |
487 // Google document are not opened by drive apps but file manager. | 487 // Google document are not opened by drive apps but file manager. |
488 if (!has_google_document) { | 488 if (!has_google_document) { |
489 drive::DriveIntegrationService* integration_service = | 489 drive::DriveAppRegistry* app_registry = |
490 drive::DriveIntegrationServiceFactory::GetForProfile(profile); | 490 drive::util::GetDriveAppRegistryByProfile(profile); |
491 // |integration_service| is NULL if Drive is disabled. | 491 if (!app_registry) { |
492 if (!integration_service || !integration_service->drive_app_registry()) | 492 // |app_registry| is NULL if Drive is disabled. |
493 return; | 493 return; |
| 494 } |
494 | 495 |
495 FindDriveAppTasks(*integration_service->drive_app_registry(), | 496 FindDriveAppTasks(*app_registry, path_mime_set, result_list); |
496 path_mime_set, | |
497 result_list); | |
498 } | 497 } |
499 | 498 |
500 // Find and append file handler tasks. We know there aren't duplicates | 499 // Find and append file handler tasks. We know there aren't duplicates |
501 // because Drive apps and platform apps are entirely different kinds of | 500 // because Drive apps and platform apps are entirely different kinds of |
502 // tasks. | 501 // tasks. |
503 FindFileHandlerTasks(profile, | 502 FindFileHandlerTasks(profile, |
504 path_mime_set, | 503 path_mime_set, |
505 result_list); | 504 result_list); |
506 | 505 |
507 // Find and append file browser handler tasks. We know there aren't | 506 // Find and append file browser handler tasks. We know there aren't |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 if (file_browser_handlers::IsFallbackFileBrowserHandler( | 549 if (file_browser_handlers::IsFallbackFileBrowserHandler( |
551 task->task_descriptor())) { | 550 task->task_descriptor())) { |
552 task->set_is_default(true); | 551 task->set_is_default(true); |
553 return; | 552 return; |
554 } | 553 } |
555 } | 554 } |
556 } | 555 } |
557 | 556 |
558 } // namespace file_tasks | 557 } // namespace file_tasks |
559 } // namespace file_manager | 558 } // namespace file_manager |
OLD | NEW |