| 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/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" |
| 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/file_system_util.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/file_manager/file_browser_handlers.h" | 14 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h" |
| 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 16 #include "chrome/browser/chromeos/file_manager/open_util.h" | 16 #include "chrome/browser/chromeos/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" |
| 23 #include "chrome/browser/extensions/extension_tab_util.h" | 23 #include "chrome/browser/extensions/extension_tab_util.h" |
| 24 #include "chrome/browser/extensions/extension_util.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 26 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 26 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" | 27 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" |
| 27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 28 #include "webkit/browser/fileapi/file_system_context.h" | 29 #include "webkit/browser/fileapi/file_system_context.h" |
| 29 #include "webkit/browser/fileapi/file_system_url.h" | 30 #include "webkit/browser/fileapi/file_system_url.h" |
| 30 | 31 |
| 31 using extensions::Extension; | 32 using extensions::Extension; |
| 32 using extensions::app_file_handler_util::FindFileHandlersForFiles; | 33 using extensions::app_file_handler_util::FindFileHandlersForFiles; |
| 33 using fileapi::FileSystemURL; | 34 using fileapi::FileSystemURL; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); | 384 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); |
| 384 iter != service->extensions()->end(); | 385 iter != service->extensions()->end(); |
| 385 ++iter) { | 386 ++iter) { |
| 386 const Extension* extension = iter->get(); | 387 const Extension* extension = iter->get(); |
| 387 | 388 |
| 388 // We don't support using hosted apps to open files. | 389 // We don't support using hosted apps to open files. |
| 389 if (!extension->is_platform_app()) | 390 if (!extension->is_platform_app()) |
| 390 continue; | 391 continue; |
| 391 | 392 |
| 392 if (profile->IsOffTheRecord() && | 393 if (profile->IsOffTheRecord() && |
| 393 !service->IsIncognitoEnabled(extension->id())) | 394 !extension_util::IsIncognitoEnabled(extension->id(), service)) |
| 394 continue; | 395 continue; |
| 395 | 396 |
| 396 typedef std::vector<const extensions::FileHandlerInfo*> FileHandlerList; | 397 typedef std::vector<const extensions::FileHandlerInfo*> FileHandlerList; |
| 397 FileHandlerList file_handlers = | 398 FileHandlerList file_handlers = |
| 398 FindFileHandlersForFiles(*extension, path_mime_set); | 399 FindFileHandlersForFiles(*extension, path_mime_set); |
| 399 if (file_handlers.empty()) | 400 if (file_handlers.empty()) |
| 400 continue; | 401 continue; |
| 401 | 402 |
| 402 for (FileHandlerList::iterator i = file_handlers.begin(); | 403 for (FileHandlerList::iterator i = file_handlers.begin(); |
| 403 i != file_handlers.end(); ++i) { | 404 i != file_handlers.end(); ++i) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 if (file_browser_handlers::IsFallbackFileBrowserHandler( | 531 if (file_browser_handlers::IsFallbackFileBrowserHandler( |
| 531 task->task_descriptor())) { | 532 task->task_descriptor())) { |
| 532 task->set_is_default(true); | 533 task->set_is_default(true); |
| 533 return; | 534 return; |
| 534 } | 535 } |
| 535 } | 536 } |
| 536 } | 537 } |
| 537 | 538 |
| 538 } // namespace file_tasks | 539 } // namespace file_tasks |
| 539 } // namespace file_manager | 540 } // namespace file_manager |
| OLD | NEW |