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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 file_def->SetString("fileSystemName", file_system_name); | 987 file_def->SetString("fileSystemName", file_system_name); |
988 file_def->SetString("fileSystemRoot", file_system_root.spec()); | 988 file_def->SetString("fileSystemRoot", file_system_root.spec()); |
989 FilePath root(FILE_PATH_LITERAL("/")); | 989 FilePath root(FILE_PATH_LITERAL("/")); |
990 FilePath full_path = root.Append(iter->virtual_path); | 990 FilePath full_path = root.Append(iter->virtual_path); |
991 file_def->SetString("fileFullPath", full_path.value()); | 991 file_def->SetString("fileFullPath", full_path.value()); |
992 file_def->SetBoolean("fileIsDirectory", iter->is_directory); | 992 file_def->SetBoolean("fileIsDirectory", iter->is_directory); |
993 } | 993 } |
994 | 994 |
995 details->SetInteger("tab_id", tab_id_); | 995 details->SetInteger("tab_id", tab_id_); |
996 | 996 |
997 event_router->DispatchEventToExtension( | 997 scoped_ptr<extensions::Event> event(new extensions::Event( |
998 extension_id(), std::string("fileBrowserHandler.onExecute"), | 998 "fileBrowserHandler.onExecute", event_args.Pass())); |
999 event_args.Pass(), profile(), GURL()); | 999 event->restrict_to_profile = profile(); |
| 1000 event_router->DispatchEventToExtension(extension_id(), event.Pass()); |
1000 ExecuteDoneOnUIThread(true); | 1001 ExecuteDoneOnUIThread(true); |
1001 } | 1002 } |
1002 | 1003 |
1003 void ExtensionTaskExecutor::InitHandlerHostFileAccessPermissions( | 1004 void ExtensionTaskExecutor::InitHandlerHostFileAccessPermissions( |
1004 const FileDefinitionList& file_list, | 1005 const FileDefinitionList& file_list, |
1005 const Extension* handler_extension, | 1006 const Extension* handler_extension, |
1006 const base::Closure& callback) { | 1007 const base::Closure& callback) { |
1007 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1008 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1008 | 1009 |
1009 scoped_ptr<std::vector<FilePath> > gdata_paths(new std::vector<FilePath>); | 1010 scoped_ptr<std::vector<FilePath> > gdata_paths(new std::vector<FilePath>); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 if (!external_provider || !external_provider->IsAccessAllowed(url)) | 1138 if (!external_provider || !external_provider->IsAccessAllowed(url)) |
1138 return false; | 1139 return false; |
1139 | 1140 |
1140 FilePath local_path = url.path(); | 1141 FilePath local_path = url.path(); |
1141 extensions::LaunchPlatformAppWithFileHandler(profile(), GetExtension(), | 1142 extensions::LaunchPlatformAppWithFileHandler(profile(), GetExtension(), |
1142 action_id_, local_path); | 1143 action_id_, local_path); |
1143 return true; | 1144 return true; |
1144 } | 1145 } |
1145 | 1146 |
1146 } // namespace file_handler_util | 1147 } // namespace file_handler_util |
OLD | NEW |