| 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_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_host.h" | 16 #include "chrome/browser/extensions/extension_host.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/extensions/extension_util.h" | 19 #include "chrome/browser/extensions/extension_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 22 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" | 22 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/child_process_security_policy.h" | 24 #include "content/public/browser/child_process_security_policy.h" |
| 25 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/browser/site_instance.h" | 26 #include "content/public/browser/site_instance.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "extensions/browser/event_router.h" | 28 #include "extensions/browser/event_router.h" |
| 29 #include "extensions/browser/lazy_background_task_queue.h" | 29 #include "extensions/browser/lazy_background_task_queue.h" |
| 30 #include "extensions/common/extension_set.h" |
| 30 #include "extensions/common/manifest_handlers/background_info.h" | 31 #include "extensions/common/manifest_handlers/background_info.h" |
| 31 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
| 32 #include "webkit/browser/fileapi/file_system_context.h" | 33 #include "webkit/browser/fileapi/file_system_context.h" |
| 33 #include "webkit/browser/fileapi/file_system_url.h" | 34 #include "webkit/browser/fileapi/file_system_url.h" |
| 34 #include "webkit/common/fileapi/file_system_info.h" | 35 #include "webkit/common/fileapi/file_system_info.h" |
| 35 #include "webkit/common/fileapi/file_system_util.h" | 36 #include "webkit/common/fileapi/file_system_util.h" |
| 36 | 37 |
| 37 using content::BrowserThread; | 38 using content::BrowserThread; |
| 38 using content::ChildProcessSecurityPolicy; | 39 using content::ChildProcessSecurityPolicy; |
| 39 using content::SiteInstance; | 40 using content::SiteInstance; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 extensions::ExtensionSystem::Get(profile)->extension_service(); | 95 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 95 // In unit-tests, we may not have an ExtensionService. | 96 // In unit-tests, we may not have an ExtensionService. |
| 96 if (!service) | 97 if (!service) |
| 97 return FileBrowserHandlerList(); | 98 return FileBrowserHandlerList(); |
| 98 | 99 |
| 99 // We need case-insensitive matching, and pattern in the handler is already | 100 // We need case-insensitive matching, and pattern in the handler is already |
| 100 // in lower case. | 101 // in lower case. |
| 101 const GURL lowercase_url(EscapedUtf8ToLower(selected_file_url.spec())); | 102 const GURL lowercase_url(EscapedUtf8ToLower(selected_file_url.spec())); |
| 102 | 103 |
| 103 FileBrowserHandlerList results; | 104 FileBrowserHandlerList results; |
| 104 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); | 105 for (extensions::ExtensionSet::const_iterator iter = |
| 105 iter != service->extensions()->end(); | 106 service->extensions()->begin(); |
| 106 ++iter) { | 107 iter != service->extensions()->end(); ++iter) { |
| 107 const Extension* extension = iter->get(); | 108 const Extension* extension = iter->get(); |
| 108 if (profile->IsOffTheRecord() && | 109 if (profile->IsOffTheRecord() && |
| 109 !extension_util::IsIncognitoEnabled(extension->id(), service)) | 110 !extension_util::IsIncognitoEnabled(extension->id(), service)) |
| 110 continue; | 111 continue; |
| 111 | 112 |
| 112 FileBrowserHandler::List* handler_list = | 113 FileBrowserHandler::List* handler_list = |
| 113 FileBrowserHandler::GetHandlers(extension); | 114 FileBrowserHandler::GetHandlers(extension); |
| 114 if (!handler_list) | 115 if (!handler_list) |
| 115 continue; | 116 continue; |
| 116 for (FileBrowserHandler::List::const_iterator handler_iter = | 117 for (FileBrowserHandler::List::const_iterator handler_iter = |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 common_handlers.erase(gallery_iter); | 546 common_handlers.erase(gallery_iter); |
| 546 else | 547 else |
| 547 common_handlers.erase(watch_iter); | 548 common_handlers.erase(watch_iter); |
| 548 } | 549 } |
| 549 | 550 |
| 550 return common_handlers; | 551 return common_handlers; |
| 551 } | 552 } |
| 552 | 553 |
| 553 } // namespace file_browser_handlers | 554 } // namespace file_browser_handlers |
| 554 } // namespace file_manager | 555 } // namespace file_manager |
| OLD | NEW |