Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h" |
| 6 | |
Ben Murdoch | 2385ea3 | 2013-08-06 11:01:04 +0100 | [diff] [blame] | 7 | #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 8 | #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api_factory.h" |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 9 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h" |
| 10 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
| 11 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h" |
| 12 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" |
| 13 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_mount.h" |
| 14 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_strings.h" |
| 15 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h" |
| 16 | #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 17 | #include "chrome/browser/extensions/extension_function_registry.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 18 | |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 19 | namespace file_manager { |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 20 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 21 | FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) |
Ben Murdoch | 2385ea3 | 2013-08-06 11:01:04 +0100 | [diff] [blame] | 22 | : event_router_(new EventRouter(profile)) { |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 23 | ExtensionFunctionRegistry* registry = |
| 24 | ExtensionFunctionRegistry::GetInstance(); |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 25 | // Tasks related functions. |
| 26 | registry->RegisterFunction<ExecuteTaskFunction>(); |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 27 | registry->RegisterFunction<GetFileTasksFunction>(); |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 28 | registry->RegisterFunction<SetDefaultTaskFunction>(); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 29 | registry->RegisterFunction<ViewFilesFunction>(); |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 30 | |
| 31 | // Drive related functions. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 32 | registry->RegisterFunction<GetDriveEntryPropertiesFunction>(); |
| 33 | registry->RegisterFunction<PinDriveFileFunction>(); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 34 | registry->RegisterFunction<GetDriveFilesFunction>(); |
| 35 | registry->RegisterFunction<CancelFileTransfersFunction>(); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 36 | registry->RegisterFunction<SearchDriveFunction>(); |
| 37 | registry->RegisterFunction<SearchDriveMetadataFunction>(); |
| 38 | registry->RegisterFunction<ClearDriveCacheFunction>(); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 39 | registry->RegisterFunction<GetDriveConnectionStateFunction>(); |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 40 | registry->RegisterFunction<RequestAccessTokenFunction>(); |
Ben Murdoch | bbcdd45 | 2013-07-25 10:06:34 +0100 | [diff] [blame] | 41 | registry->RegisterFunction<GetShareUrlFunction>(); |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 42 | |
| 43 | // Select file dialog related functions. |
| 44 | registry->RegisterFunction<CancelFileDialogFunction>(); |
| 45 | registry->RegisterFunction<SelectFileFunction>(); |
| 46 | registry->RegisterFunction<SelectFilesFunction>(); |
| 47 | |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 48 | // Mount points related functions. |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 49 | registry->RegisterFunction<AddMountFunction>(); |
| 50 | registry->RegisterFunction<RemoveMountFunction>(); |
| 51 | registry->RegisterFunction<GetMountPointsFunction>(); |
| 52 | |
| 53 | // Hundreds of strings for the file manager. |
| 54 | registry->RegisterFunction<GetStringsFunction>(); |
| 55 | |
| 56 | // File system related functions. |
| 57 | registry->RegisterFunction<RequestFileSystemFunction>(); |
| 58 | registry->RegisterFunction<AddFileWatchFunction>(); |
| 59 | registry->RegisterFunction<RemoveFileWatchFunction>(); |
| 60 | registry->RegisterFunction<SetLastModifiedFunction>(); |
| 61 | registry->RegisterFunction<GetSizeStatsFunction>(); |
| 62 | registry->RegisterFunction<GetVolumeMetadataFunction>(); |
| 63 | registry->RegisterFunction<ValidatePathNameLengthFunction>(); |
| 64 | registry->RegisterFunction<FormatDeviceFunction>(); |
| 65 | |
| 66 | // Miscellaneous functions. |
| 67 | registry->RegisterFunction<LogoutUserFunction>(); |
| 68 | registry->RegisterFunction<GetPreferencesFunction>(); |
| 69 | registry->RegisterFunction<SetPreferencesFunction>(); |
| 70 | registry->RegisterFunction<ZipSelectionFunction>(); |
| 71 | registry->RegisterFunction<ZoomFunction>(); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 72 | event_router_->ObserveFileSystemEvents(); |
| 73 | } |
| 74 | |
| 75 | FileBrowserPrivateAPI::~FileBrowserPrivateAPI() { |
| 76 | } |
| 77 | |
| 78 | void FileBrowserPrivateAPI::Shutdown() { |
| 79 | event_router_->Shutdown(); |
| 80 | } |
| 81 | |
| 82 | // static |
| 83 | FileBrowserPrivateAPI* FileBrowserPrivateAPI::Get(Profile* profile) { |
| 84 | return FileBrowserPrivateAPIFactory::GetForProfile(profile); |
| 85 | } |
| 86 | |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 87 | } // namespace file_manager |