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_handler_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_handler_util.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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/extensions/extension_tab_util.h" | 22 #include "chrome/browser/extensions/extension_tab_util.h" |
23 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 23 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
24 #include "chrome/browser/extensions/platform_app_launcher.h" | 24 #include "chrome/browser/extensions/platform_app_launcher.h" |
25 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 25 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
28 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
30 #include "chrome/browser/ui/browser_tabstrip.h" | 30 #include "chrome/browser/ui/browser_tabstrip.h" |
31 #include "chrome/browser/ui/host_desktop.h" | 31 #include "chrome/browser/ui/host_desktop.h" |
| 32 #include "chrome/common/extensions/background_info.h" |
32 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/child_process_security_policy.h" | 35 #include "content/public/browser/child_process_security_policy.h" |
35 #include "content/public/browser/render_process_host.h" | 36 #include "content/public/browser/render_process_host.h" |
36 #include "content/public/browser/site_instance.h" | 37 #include "content/public/browser/site_instance.h" |
37 #include "content/public/browser/storage_partition.h" | 38 #include "content/public/browser/storage_partition.h" |
38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
39 #include "net/base/escape.h" | 40 #include "net/base/escape.h" |
40 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" | 41 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
41 #include "webkit/fileapi/file_system_context.h" | 42 #include "webkit/fileapi/file_system_context.h" |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 const FileTaskFinishedCallback& done) { | 814 const FileTaskFinishedCallback& done) { |
814 if (!FileBrowserHasAccessPermissionForFiles(file_urls)) | 815 if (!FileBrowserHasAccessPermissionForFiles(file_urls)) |
815 return false; | 816 return false; |
816 | 817 |
817 scoped_refptr<const Extension> handler = GetExtension(); | 818 scoped_refptr<const Extension> handler = GetExtension(); |
818 if (!handler.get()) | 819 if (!handler.get()) |
819 return false; | 820 return false; |
820 | 821 |
821 int handler_pid = ExtractProcessFromExtensionId(profile(), handler->id()); | 822 int handler_pid = ExtractProcessFromExtensionId(profile(), handler->id()); |
822 if (handler_pid <= 0) { | 823 if (handler_pid <= 0) { |
823 if (!handler->has_lazy_background_page()) | 824 if (!extensions::BackgroundInfo::HasLazyBackgroundPage(handler)) |
824 return false; | 825 return false; |
825 } | 826 } |
826 | 827 |
827 done_ = done; | 828 done_ = done; |
828 | 829 |
829 // Get file system context for the extension to which onExecute event will be | 830 // Get file system context for the extension to which onExecute event will be |
830 // send. The file access permissions will be granted to the extension in the | 831 // send. The file access permissions will be granted to the extension in the |
831 // file system context for the files in |file_urls|. | 832 // file system context for the files in |file_urls|. |
832 GURL site = extensions::ExtensionSystem::Get(profile())->extension_service()-> | 833 GURL site = extensions::ExtensionSystem::Get(profile())->extension_service()-> |
833 GetSiteForExtensionId(handler->id()); | 834 GetSiteForExtensionId(handler->id()); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 extensions::LaunchPlatformAppWithFileHandler(profile(), GetExtension(), | 1004 extensions::LaunchPlatformAppWithFileHandler(profile(), GetExtension(), |
1004 action_id_, file_urls[i].path()); | 1005 action_id_, file_urls[i].path()); |
1005 } | 1006 } |
1006 | 1007 |
1007 if (!done.is_null()) | 1008 if (!done.is_null()) |
1008 done.Run(true); | 1009 done.Run(true); |
1009 return true; | 1010 return true; |
1010 } | 1011 } |
1011 | 1012 |
1012 } // namespace file_handler_util | 1013 } // namespace file_handler_util |
OLD | NEW |