| 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_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <sys/statvfs.h> | 8 #include <sys/statvfs.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <utime.h> | 10 #include <utime.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/time.h" | 24 #include "base/time.h" |
| 25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 26 #include "base/values.h" | 26 #include "base/values.h" |
| 27 #include "chrome/browser/chromeos/drive/drive.pb.h" | 27 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 28 #include "chrome/browser/chromeos/drive/drive_cache.h" | 28 #include "chrome/browser/chromeos/drive/drive_cache.h" |
| 29 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" | 29 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" |
| 30 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 30 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 31 #include "chrome/browser/chromeos/drive/drive_system_service.h" | 31 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
| 32 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 32 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
| 33 #include "chrome/browser/chromeos/drive/search_metadata.h" | 33 #include "chrome/browser/chromeos/drive/search_metadata.h" |
| 34 #include "chrome/browser/chromeos/extensions/file_browser_handler.h" | |
| 35 #include "chrome/browser/chromeos/extensions/file_browser_private_api_factory.h" | 34 #include "chrome/browser/chromeos/extensions/file_browser_private_api_factory.h" |
| 35 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler.h
" |
| 36 #include "chrome/browser/chromeos/extensions/file_manager/file_handler_util.h" | 36 #include "chrome/browser/chromeos/extensions/file_manager/file_handler_util.h" |
| 37 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" | 37 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" |
| 38 #include "chrome/browser/chromeos/extensions/zip_file_creator.h" | 38 #include "chrome/browser/chromeos/extensions/zip_file_creator.h" |
| 39 #include "chrome/browser/chromeos/settings/cros_settings.h" | 39 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 40 #include "chrome/browser/chromeos/system/statistics_provider.h" | 40 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 41 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 41 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 42 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 42 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 43 #include "chrome/browser/extensions/extension_function_registry.h" | 43 #include "chrome/browser/extensions/extension_function_registry.h" |
| 44 #include "chrome/browser/extensions/extension_process_manager.h" | 44 #include "chrome/browser/extensions/extension_process_manager.h" |
| 45 #include "chrome/browser/extensions/extension_service.h" | 45 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 RequestLocalFileSystemFunction* function_; | 558 RequestLocalFileSystemFunction* function_; |
| 559 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 559 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 560 // Renderer process id. | 560 // Renderer process id. |
| 561 int child_id_; | 561 int child_id_; |
| 562 // Extension source URL. | 562 // Extension source URL. |
| 563 scoped_refptr<const Extension> extension_; | 563 scoped_refptr<const Extension> extension_; |
| 564 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemCallbackDispatcher); | 564 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemCallbackDispatcher); |
| 565 }; | 565 }; |
| 566 | 566 |
| 567 FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) | 567 FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) |
| 568 : event_router_(new FileBrowserEventRouter(profile)) { | 568 : event_router_(new FileManagerEventRouter(profile)) { |
| 569 (new FileBrowserHandlerParser)->Register(); | 569 (new FileBrowserHandlerParser)->Register(); |
| 570 | 570 |
| 571 ExtensionFunctionRegistry* registry = | 571 ExtensionFunctionRegistry* registry = |
| 572 ExtensionFunctionRegistry::GetInstance(); | 572 ExtensionFunctionRegistry::GetInstance(); |
| 573 registry->RegisterFunction<LogoutUserFunction>(); | 573 registry->RegisterFunction<LogoutUserFunction>(); |
| 574 registry->RegisterFunction<CancelFileDialogFunction>(); | 574 registry->RegisterFunction<CancelFileDialogFunction>(); |
| 575 registry->RegisterFunction<ExecuteTasksFileBrowserFunction>(); | 575 registry->RegisterFunction<ExecuteTasksFileBrowserFunction>(); |
| 576 registry->RegisterFunction<SetDefaultTaskFileBrowserFunction>(); | 576 registry->RegisterFunction<SetDefaultTaskFileBrowserFunction>(); |
| 577 registry->RegisterFunction<FileDialogStringsFunction>(); | 577 registry->RegisterFunction<FileDialogStringsFunction>(); |
| 578 registry->RegisterFunction<GetFileTasksFileBrowserFunction>(); | 578 registry->RegisterFunction<GetFileTasksFileBrowserFunction>(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 721 |
| 722 return true; | 722 return true; |
| 723 } | 723 } |
| 724 | 724 |
| 725 void AddFileWatchBrowserFunction::PerformFileWatchOperation( | 725 void AddFileWatchBrowserFunction::PerformFileWatchOperation( |
| 726 const base::FilePath& local_path, | 726 const base::FilePath& local_path, |
| 727 const base::FilePath& virtual_path, | 727 const base::FilePath& virtual_path, |
| 728 const std::string& extension_id) { | 728 const std::string& extension_id) { |
| 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 730 | 730 |
| 731 FileBrowserEventRouter* event_router = | 731 FileManagerEventRouter* event_router = |
| 732 FileBrowserPrivateAPI::Get(profile_)->event_router(); | 732 FileBrowserPrivateAPI::Get(profile_)->event_router(); |
| 733 event_router->AddFileWatch( | 733 event_router->AddFileWatch( |
| 734 local_path, | 734 local_path, |
| 735 virtual_path, | 735 virtual_path, |
| 736 extension_id, | 736 extension_id, |
| 737 base::Bind(&AddFileWatchBrowserFunction::Respond, this)); | 737 base::Bind(&AddFileWatchBrowserFunction::Respond, this)); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void RemoveFileWatchBrowserFunction::PerformFileWatchOperation( | 740 void RemoveFileWatchBrowserFunction::PerformFileWatchOperation( |
| 741 const base::FilePath& local_path, | 741 const base::FilePath& local_path, |
| 742 const base::FilePath& unused, | 742 const base::FilePath& unused, |
| 743 const std::string& extension_id) { | 743 const std::string& extension_id) { |
| 744 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 744 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 745 | 745 |
| 746 FileBrowserEventRouter* event_router = | 746 FileManagerEventRouter* event_router = |
| 747 FileBrowserPrivateAPI::Get(profile_)->event_router(); | 747 FileBrowserPrivateAPI::Get(profile_)->event_router(); |
| 748 event_router->RemoveFileWatch(local_path, extension_id); | 748 event_router->RemoveFileWatch(local_path, extension_id); |
| 749 Respond(true); | 749 Respond(true); |
| 750 } | 750 } |
| 751 | 751 |
| 752 // static | 752 // static |
| 753 void GetFileTasksFileBrowserFunction::IntersectAvailableDriveTasks( | 753 void GetFileTasksFileBrowserFunction::IntersectAvailableDriveTasks( |
| 754 drive::DriveWebAppsRegistry* registry, | 754 drive::DriveWebAppsRegistry* registry, |
| 755 const FileInfoList& file_info_list, | 755 const FileInfoList& file_info_list, |
| 756 WebAppInfoMap* app_info, | 756 WebAppInfoMap* app_info, |
| (...skipping 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3334 OpenNewWindowFunction::OpenNewWindowFunction() {} | 3334 OpenNewWindowFunction::OpenNewWindowFunction() {} |
| 3335 | 3335 |
| 3336 OpenNewWindowFunction::~OpenNewWindowFunction() {} | 3336 OpenNewWindowFunction::~OpenNewWindowFunction() {} |
| 3337 | 3337 |
| 3338 bool OpenNewWindowFunction::RunImpl() { | 3338 bool OpenNewWindowFunction::RunImpl() { |
| 3339 std::string url; | 3339 std::string url; |
| 3340 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); | 3340 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); |
| 3341 file_manager_util::OpenNewWindow(profile_, GURL(url)); | 3341 file_manager_util::OpenNewWindow(profile_, GURL(url)); |
| 3342 return true; | 3342 return true; |
| 3343 } | 3343 } |
| OLD | NEW |