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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 const FileDefinitionList& file_list, | 763 const FileDefinitionList& file_list, |
764 int handler_pid) { | 764 int handler_pid) { |
765 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 765 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
766 | 766 |
767 const Extension* extension = GetExtension(); | 767 const Extension* extension = GetExtension(); |
768 if (!extension) { | 768 if (!extension) { |
769 ExecuteDoneOnUIThread(false); | 769 ExecuteDoneOnUIThread(false); |
770 return; | 770 return; |
771 } | 771 } |
772 | 772 |
773 if (handler_pid > 0) { | 773 queue->AddPendingTask( |
Matt Perry
2012/07/24 19:25:15
This potentially changes the behavior.. If handler
koz (OOO until 15th September)
2012/07/25 07:48:31
Ah, true. We probably only want to change the else
| |
774 SetupPermissionsAndDispatchEvent(file_system_name, file_system_root, | 774 profile(), extension_id_, |
775 file_list, handler_pid, NULL); | 775 base::Bind(&ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent, |
776 } else { | 776 this, file_system_name, file_system_root, file_list, |
777 // We have to wake the handler background page before we proceed. | 777 handler_pid)); |
778 extensions::LazyBackgroundTaskQueue* queue = | |
779 extensions::ExtensionSystem::Get(profile())-> | |
780 lazy_background_task_queue(); | |
781 if (!queue->ShouldEnqueueTask(profile(), extension)) { | |
782 ExecuteDoneOnUIThread(false); | |
783 return; | |
784 } | |
785 queue->AddPendingTask( | |
786 profile(), extension_id_, | |
787 base::Bind(&ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent, | |
788 this, file_system_name, file_system_root, file_list, | |
789 handler_pid)); | |
790 } | 778 } |
791 } | 779 } |
792 | 780 |
793 void ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent( | 781 void ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent( |
794 const std::string& file_system_name, | 782 const std::string& file_system_name, |
795 const GURL& file_system_root, | 783 const GURL& file_system_root, |
796 const FileDefinitionList& file_list, | 784 const FileDefinitionList& file_list, |
797 int handler_pid_in, | 785 int handler_pid_in, |
798 ExtensionHost* host) { | 786 ExtensionHost* host) { |
799 int handler_pid = host ? host->render_process_host()->GetID() : | 787 int handler_pid = host ? host->render_process_host()->GetID() : |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 handler_host_permissions_[i].first, | 879 handler_host_permissions_[i].first, |
892 handler_host_permissions_[i].second); | 880 handler_host_permissions_[i].second); |
893 } | 881 } |
894 | 882 |
895 // We don't need this anymore. | 883 // We don't need this anymore. |
896 handler_host_permissions_.clear(); | 884 handler_host_permissions_.clear(); |
897 } | 885 } |
898 | 886 |
899 } // namespace file_handler_util | 887 } // namespace file_handler_util |
900 | 888 |
OLD | NEW |