Home | History | Annotate | Download | only in api
      1 // Copyright 2013 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 // fileBrowserPrivate API.
      6 // This is a private API used by the file browser of ChromeOS.
      7 [platforms=("chromeos"),
      8  implemented_in="chrome/browser/chromeos/extensions/file_manager/file_browser_private_api_functions.h"]
      9 namespace fileBrowserPrivate {
     10 // Type of the mounted volume.
     11 enum VolumeType { drive, downloads, removable, archive, cloud_device, provided,
     12                   mtp, testing };
     13 
     14 // Device type. Available if this is removable volume.
     15 enum DeviceType { usb, sd, optical, mobile, unknown };
     16 
     17 // Additional data about mount, for example, that the filesystem is not
     18 // supported.
     19 enum MountCondition { unknown, unsupported };
     20 
     21 // Is the event raised for mounting or unmounting.
     22 enum MountCompletedEventType { mount, unmount };
     23 
     24 // Event type that tells listeners if mount was successful or an error
     25 // occurred. It also specifies the error.
     26 enum MountCompletedStatus {
     27   success,
     28   error_unknown,
     29   error_internal,
     30   error_invalid_argument,
     31   error_invalid_path,
     32   error_path_already_mounted,
     33   error_path_not_mounted,
     34   error_directory_creation_failed,
     35   error_invalid_mount_options,
     36   error_invalid_unmount_options,
     37   error_insufficient_permissions,
     38   error_mount_program_not_found,
     39   error_mount_program_failed,
     40   error_invalid_device_path,
     41   error_unknown_filesystem,
     42   error_unsuported_filesystem,
     43   error_invalid_archive,
     44   error_authentication,
     45   error_path_unmounted
     46 };
     47 
     48 // File transfer progress state.
     49 enum TransferState { started, in_progress, completed, failed };
     50 
     51 // Defines file transfer direction.
     52 enum TransferType { upload, download };
     53 
     54 // The type of the progress event.
     55 enum CopyProgressStatusType {
     56   // "begin_copy_entry" is fired for each entry (file or directory) before
     57   // starting the copy operation.
     58   begin_copy_entry,
     59 
     60   // "end_copy_entry" is fired for each entry (file or directory) after ending
     61   // the copy operation.
     62   end_copy_entry,
     63 
     64   // "progress" is fired periodically to report progress of a file copy (not
     65   // directory).
     66   progress,
     67 
     68   // "success" is fired after all entries are copied.
     69   success,
     70 
     71   // "error" is fired when an error occurs.
     72   error
     73 };
     74 
     75 // Specifies type of event that is raised.
     76 enum FileWatchEventType { changed, error };
     77 
     78 // The type of entry that is needed. Default to ALL.
     79 enum SearchType { EXCLUDE_DIRECTORIES, SHARED_WITH_ME, OFFLINE, ALL };
     80 
     81 // Zooming mode.
     82 enum ZoomOperationType { in, out, reset };
     83 
     84 // Specifies how to open inspector.
     85 enum InspectionType {
     86   // Open inspector for foreground page.
     87   normal,
     88   // Open inspector for foreground page and bring focus to the console.
     89   console,
     90   // Open inspector for foreground page in inspect element mode.
     91   element,
     92   // Open inspector for background page.
     93   background
     94 };
     95 
     96 // Device event type.
     97 enum DeviceEventType {
     98   // Device is added.
     99   added,
    100   // If the device is disabled by preference, the disabled event is published
    101   // instead of the added event.
    102   disabled,
    103   // Device is added, but scan for the device is canceled. The event is
    104   // published after the added event.
    105   scan_canceled,
    106   // Device is removed.
    107   removed,
    108   // Device is hard unplugged.
    109   hard_unplugged,
    110   // Format started.
    111   format_start,
    112   // Format succeeded.
    113   format_success,
    114   // Format failed.
    115   format_fail
    116 };
    117 
    118 // Drive sync error type.
    119 // Keep it synced with DriveSyncErrorType in operation_observer.h.
    120 enum DriveSyncErrorType {
    121   // Request to delete a file without permission.
    122   delete_without_permission,
    123   // Google Drive is temporarily unavailable.
    124   service_unavailable,
    125   // Miscellaneous errors other than listed above.
    126   misc
    127 };
    128 
    129 // Result of task execution.
    130 enum TaskResult {
    131   // The task execution succeeded and a new window/tab was opened.
    132   opened,
    133   // The task execution succeeded and the message was sent to the proper
    134   // extension.
    135   message_sent,
    136   // The task execution failed.
    137   failed,
    138   // No URL is specified.
    139   empty
    140 };
    141 
    142 // Drive share type.
    143 enum DriveShareType {
    144   can_edit,
    145   can_comment,
    146   can_view
    147 };
    148 
    149 // ImageSet that represents multi-scale images.
    150 dictionary ImageSet {
    151   // 1x scale URL.
    152   DOMString scale1xUrl;
    153   // 2x scale URL.
    154   DOMString scale2xUrl;
    155 };
    156 
    157 // A file task represents an action that the file manager can perform over the
    158 // currently selected files. See
    159 // chrome/browser/chromeos/extensions/file_manager/file_tasks.h for details
    160 // about how file tasks are handled.
    161 dictionary FileTask {
    162   // The unique identifier of the task.
    163   DOMString taskId;
    164 
    165   // Task title (ex. App name).
    166   DOMString title;
    167 
    168   // Task icon url (from chrome://extension-icon/...)
    169   DOMString iconUrl;
    170 
    171   // True if this task is a default task for the selected files.
    172   boolean isDefault;
    173 };
    174 
    175 // Drive file properties.
    176 dictionary DriveEntryProperties {
    177   // Size of this file.
    178   double? fileSize;
    179 
    180   // Timestamp of entry update time, in milliseconds past the epoch.
    181   double? lastModifiedTime;
    182 
    183   // URL to the Drive thumbnail image for this file.
    184   DOMString? thumbnailUrl;
    185 
    186   // Width, if the entry is an image.
    187   long? imageWidth;
    188 
    189   // Height, if the entry is an image.
    190   long? imageHeight;
    191 
    192   // Rotation in clockwise degrees, if the entry is an image.
    193   long? imageRotation;
    194 
    195   // True if the file is pinned in Drive cache.
    196   boolean? isPinned;
    197 
    198   // True if the file is present in Drive cache.
    199   boolean? isPresent;
    200 
    201   // True if the file is hosted on a Drive server instead of local.
    202   boolean? isHosted;
    203 
    204   // URL to the custom icon for this file.
    205   DOMString? customIconUrl;
    206 
    207   // Drive MIME type for this file.
    208   DOMString? contentMimeType;
    209 
    210   // True if the entry is labeled as shared-with-me.
    211   boolean? sharedWithMe;
    212 
    213   // True if the entry is labeled as shared (either from me to others or to me
    214   // by others.)
    215   boolean? shared;
    216 };
    217 
    218 // Information about total and remaining size on the mount point.
    219 dictionary MountPointSizeStats {
    220   // Approximate total available size on the mount point.
    221   double totalSize;
    222 
    223   // Approximate remaining available size on the mount point.
    224   double remainingSize;
    225 };
    226 
    227 // Information about a profile.
    228 dictionary ProfileInfo {
    229   // Profile ID. This is currently e-mail address of the profile.
    230   DOMString profileId;
    231 
    232   // The name of the profile for display purpose.
    233   DOMString displayName;
    234 
    235   // True if the profile is the one running the current file manager instance.
    236   // TODO(hirono): Remove the property because of the design change of
    237   // multi-profile suuport.
    238   boolean isCurrentProfile;
    239 
    240   // Image set of profile image.
    241   ImageSet? profileImage;
    242 };
    243 
    244 // Mounted disk volume metadata.
    245 dictionary VolumeMetadata {
    246   // ID of the disk volume.
    247   DOMString volumeId;
    248 
    249   // Id the provided file system (for proviided file systems).
    250   DOMString? fileSystemId;
    251 
    252   // Extension providing this volume (for provided file systems).
    253   DOMString? extensionId;
    254 
    255   // Label of the volume (if available).
    256   DOMString? volumeLabel;
    257 
    258   // Description of the profile where the volume belongs.
    259   // TODO(hirono): Remove the property because of the design change of
    260   // multi-profile support.
    261   ProfileInfo profile;
    262 
    263   // The path to the mounted device, archive file or network resource.
    264   DOMString? sourcePath;
    265 
    266   // Type of the mounted volume.
    267   VolumeType volumeType;
    268 
    269   // Device type. Available if this is removable volume.
    270   DeviceType? deviceType;
    271 
    272   // Path to identify the device. This is consistent with DeviceEvent's
    273   // devicePath.
    274   DOMString? devicePath;
    275 
    276   // Whether the device is parent or not (i.e. sdb rather than sdb1).
    277   boolean? isParentDevice;
    278 
    279   // Flag that specifies if volume is mounted in read-only mode.
    280   boolean isReadOnly;
    281 
    282   // Additional data about mount, for example, that the filesystem is not
    283   // supported.
    284   MountCondition? mountCondition;
    285 };
    286 
    287 // Payload data for mount event.
    288 dictionary MountCompletedEvent {
    289   // Is the event raised for mounting or unmounting.
    290   MountCompletedEventType eventType;
    291 
    292   // Event type that tells listeners if mount was successful or an error
    293   // occurred. It also specifies the error.
    294   MountCompletedStatus status;
    295 
    296   // Metadata of the mounted volume.
    297   VolumeMetadata volumeMetadata;
    298 
    299   // Whether it is remount or not.
    300   boolean isRemounting;
    301 };
    302 
    303 // Payload data for file transfer status updates.
    304 dictionary FileTransferStatus {
    305   // URL of file that is being transfered.
    306   DOMString fileUrl;
    307 
    308   // File transfer progress state.
    309   TransferState transferState;
    310 
    311   // Defines file transfer direction.
    312   TransferType transferType;
    313 
    314   // Approximated completed portion of the transfer operation.
    315   double? processed;
    316 
    317   // Approximated total size of transfer operation.
    318   double? total;
    319 };
    320 
    321 // Error during the drive sync.
    322 dictionary DriveSyncErrorEvent {
    323   // Error type.
    324   DriveSyncErrorType type;
    325 
    326   // File URL of the entry that the error happens to.
    327   DOMString fileUrl;
    328 };
    329 
    330 // Payload data for copy status progress updates.
    331 dictionary CopyProgressStatus {
    332   // The type of the progress event.
    333   CopyProgressStatusType type;
    334 
    335   // URL for the entry currently being copied. This field is particularly useful
    336   // when a directory copy is initiated with startCopy(). The field tells what
    337   // file/directory in that directory is now being copied.
    338   DOMString? sourceUrl;
    339 
    340   // URL for the entry currently being created. This field is particularly
    341   // useful when a directory copy is initiated with startCopy(). The field tells
    342   // what file/directory in that directory is being created. Available only for
    343   // end_copy_entry and success.
    344   DOMString? destinationUrl;
    345 
    346   // Number of processed bytes for the file currently being copied. Available
    347   // only for "progress" event. To show the progress bar, a caller needs to
    348   // pre-compute the size of files being copied for the file (not directory).
    349   double? size;
    350 
    351   // DOMError's name. Available only for ERROR event.
    352   DOMString? error;
    353 };
    354 
    355 // Payload data for file transfer cancel response.
    356 dictionary FileTransferCancelStatus {
    357   // URL of file that is being transfered.
    358   DOMString fileUrl;
    359 
    360   // True if ongoing transfer operation was found and canceled.
    361   boolean canceled;
    362 };
    363 
    364 // Directory change notification details.
    365 dictionary FileWatchEvent {
    366   // Specifies type of event that is raised.
    367   FileWatchEventType eventType;
    368 
    369   // An Entry object which represents a changed directory. The conversion into a
    370   // kind of FileEntry object is done in
    371   // file_browser_handler_custom_bindings.cc. For filesystem API's Entry
    372   // interface, see <a
    373   // href='http://www.w3.org/TR/file-system-api/#the-entry-interface'>The Entry
    374   // interface</a>.
    375   [instanceOf=Entry] object entry;
    376 };
    377 
    378 dictionary Preferences {
    379   boolean driveEnabled;
    380   boolean cellularDisabled;
    381   boolean hostedFilesDisabled;
    382   boolean use24hourClock;
    383   boolean allowRedeemOffers;
    384 };
    385 
    386 dictionary PreferencesChange {
    387   boolean? cellularDisabled;
    388   boolean? hostedFilesDisabled;
    389 };
    390 
    391 dictionary SearchParams {
    392   // Search query.
    393   DOMString query;
    394 
    395   // ID of the search feed that should be fetched next. Value passed here should
    396   // be gotten from previous searchDrive call. It can be empty for the initial
    397   // search request.
    398   DOMString nextFeed;
    399 };
    400 
    401 dictionary SearchMetadataParams {
    402   // Search query. It can be empty. Any filename matches to an empty query.
    403   DOMString query;
    404 
    405   // The type of entry that is needed. Default to ALL.
    406   SearchType types;
    407 
    408   // Maximum number of results.
    409   long maxResults;
    410 };
    411 
    412 // Entry and Drive-related properties representing a search result.
    413 dictionary SearchResult {
    414   // A dictionary object which represents a Drive file. This will be converted
    415   // into a kind of FileEntry object. See
    416   // file_browser_handler_custom_bindings.cc for details. For filesystem API's
    417   // Entry interface, see <a
    418   // href='http://www.w3.org/TR/file-system-api/#the-entry-interface'>The Entry
    419   // interface</a>.
    420   [instanceOf=Entry] object entry;
    421 
    422   // The base name of a Drive file that matched the search query. The matched
    423   // sub strings are highlighted with <b> element. Meta characters are escaped
    424   // like &lt;.
    425   DOMString highlightedBaseName;
    426 };
    427 
    428 dictionary DriveConnectionState {
    429   DOMString type;
    430 
    431   // Reasons of offline.
    432   DOMString? reason;
    433 };
    434 
    435 // Device event dispatched to listeners of onDeviceChaged.  See also
    436 // DeviceEventType to know when the event dispatched.
    437 dictionary DeviceEvent {
    438   // Event type of the device event.
    439   DeviceEventType type;
    440   // Device path to identify the device.
    441   DOMString devicePath;
    442 };
    443 
    444 // Callback that does not take arguments.
    445 callback SimpleCallback = void();
    446 
    447 // |result| Result of the task execution.
    448 callback ExecuteTaskCallback = void(TaskResult result);
    449 
    450 // |tasks| The list of matched file URL patterns for this task.
    451 callback GetFileTasksCallback = void(FileTask[] tasks);
    452 
    453 // |result| Hash containing the string assets.
    454 callback GetStringsCallback = void(object result);
    455 
    456 // |success| True when file watch is successfully added.
    457 callback AddFileWatchCallback = void(optional boolean success);
    458 
    459 // |success| True when file watch is successfully removed.
    460 callback RemoveFileWatchCallback = void(optional boolean success);
    461 
    462 // |fileSystem| A DOMFileSystem instance for local file system access. null if
    463 // |the caller has no appropriate permissions.
    464 callback RequestFileSystemCallback = void(optional object fileSystem);
    465 
    466 // |fileProperties| A dictionary containing properties of the requested entries.
    467 callback GetDriveEntryPropertiesCallback =
    468     void(DriveEntryProperties[] entryProperties);
    469 
    470 // |localFilePaths| An array of the local file paths for the requested files,
    471 // one entry for each file in fileUrls.
    472 callback GetDriveFilesCallback = void(DOMString[] localFilePaths);
    473 
    474 // |sourcePath| Source path of the mount.
    475 callback AddMountCallback = void(DOMString sourcePath);
    476 
    477 // |volumeMetadataList| The list of VolumeMetadata representing mounted volumes.
    478 callback GetVolumeMetadataListCallback =
    479     void(VolumeMetadata[] volumeMetadataList);
    480 
    481 // |fileTransferCancelStatuses| The list of FileTransferCancelStatus.
    482 callback CancelFileTransfersCallback =
    483     void(FileTransferCancelStatus[] fileTransferCancelStatuses);
    484 
    485 // |copyId| ID of the copy task. Can be used to identify the progress, and to
    486 // cancel the task.
    487 callback StartCopyCallback = void(long copyId);
    488 
    489 // |sizeStats| Name/value pairs of size stats. Will be undefined if stats could
    490 // not be determined.
    491 callback GetSizeStatsCallback = void(optional MountPointSizeStats sizeStats);
    492 
    493 callback GetPreferencesCallback = void(Preferences result);
    494 
    495 // |entries|
    496 // |nextFeed| ID of the feed that contains next chunk of the search result.
    497 //     Should be sent to the next searchDrive request to perform
    498 //     incremental search.
    499 callback SearchDriveCallback =
    500     void([instanceOf=Entry] object[] entries, DOMString nextFeed);
    501 
    502 callback SearchDriveMetadataCallback = void(SearchResult[] results);
    503 
    504 callback ZipSelectionCallback = void(optional boolean success);
    505 
    506 callback GetDriveConnectionStateCallback = void(DriveConnectionState result);
    507 
    508 // |result| true if the length is in the valid range, false otherwise.
    509 callback ValidatePathNameLengthCallback = void(boolean result);
    510 
    511 // |accessToken| OAuth2 access token, or an empty string if failed to fetch.
    512 callback RequestAccessTokenCallback = void(DOMString accessToken);
    513 
    514 // |accessToken| OAuth2 access token, or an empty string if failed to fetch.
    515 callback RequestWebStoreAccessTokenCallback = void(DOMString accessToken);
    516 
    517 // |shareUrl| Share Url for the sharing dialog.
    518 callback GetShareUrlCallback = void(DOMString shareUrl);
    519 
    520 // |profiles| List of profile information.
    521 // |runningProfile| ID of the profile that runs the application instance.
    522 // |showingProfile| ID of the profile that shows the application window.
    523 callback GetProfilesCallback = void(ProfileInfo[] profiles,
    524                                     DOMString runningProfile,
    525                                     DOMString displayProfile);
    526 
    527 // |entryUrl| URL of an entry in a normal file system.
    528 callback ResolveEntriesCallback =
    529     void([instanceOf=FileEntry] object[] entries);
    530 
    531 interface Functions {
    532   // Logout the current user for navigating to the re-authentication screen for
    533   // the Google account.
    534   static void logoutUserForReauthentication();
    535 
    536   // Cancels file selection.
    537   static void cancelDialog();
    538 
    539   // Executes file browser task over selected files.
    540   // |taskId| The unique identifier of task to execute.
    541   // |fileUrls| Array of file URLs
    542   // |callback|
    543   static void executeTask(DOMString taskId,
    544                           DOMString[] fileUrls,
    545                           optional ExecuteTaskCallback callback);
    546 
    547   // Sets the default task for the supplied MIME types and suffixes of the
    548   // supplied file URLs. Lists of MIME types and URLs may contain duplicates.
    549   // |taskId| The unique identifier of task to mark as default.
    550   // |fileUrls| Array of selected file URLs to extract suffixes from.
    551   // |mimeTypes| Array of selected file MIME types.
    552   // |callback|
    553   static void setDefaultTask(DOMString taskId,
    554                              DOMString[] fileUrls,
    555                              optional DOMString[] mimeTypes,
    556                              optional SimpleCallback callback);
    557 
    558   // Gets the list of tasks that can be performed over selected files.
    559   // |fileUrls| Array of selected file URLs
    560   // |mimeTypes| Array of selected file MIME types
    561   // |callback|
    562   static void getFileTasks(DOMString[] fileUrls,
    563                            DOMString[] mimeTypes,
    564                            GetFileTasksCallback callback);
    565 
    566   // Gets localized strings and initialization data.
    567   // |callback|
    568   static void getStrings(GetStringsCallback callback);
    569 
    570   // Adds file watch.
    571   // |fileUrl| URL of file to watch
    572   // |callback|
    573   static void addFileWatch(DOMString fileUrl, AddFileWatchCallback callback);
    574 
    575   // Removes file watch.
    576   // |fileUrl| URL of watched file to remove
    577   // |callback|
    578   static void removeFileWatch(DOMString fileUrl,
    579                               RemoveFileWatchCallback callback);
    580 
    581   // Requests access to a file system volume.
    582   // |volumeId| The ID of the file system volume to request. The volume ID is
    583   //     delivered to JavaScript as part of VolumeMetadata. By specifying
    584   //     "compatible", this function behaves in the compatible mode, where the
    585   //     returned FileSystem object gives access to all file system volumes such
    586   //     as Downloads folder and removal media like SD cards (i.e. all volumes
    587   //     are provided inside the single FileSystem object). In the new
    588   //     "per-volume FileSystem object model" crbug.com/322305, a separate
    589   //     FileSystem object is created for each volume. "compatible" parameter
    590   //     will be removed once Files.app is switched to the per-volume FileSystem
    591   //     object model.
    592   // |callback|
    593   static void requestFileSystem(DOMString volumeId,
    594                                 RequestFileSystemCallback callback);
    595 
    596   // Selects multiple files.
    597   // |selectedPaths| Array of selected paths
    598   // |shouldReturnLocalPath| true if paths need to be resolved to local paths.
    599   // |callback|
    600   static void selectFiles(DOMString[] selectedPaths,
    601                           boolean shouldReturnLocalPath,
    602                           SimpleCallback callback);
    603 
    604   // Selects a file.
    605   // |selectedPath| A selected path
    606   // |index| Index of Filter
    607   // |forOpening| true if paths are selected for opening. false if for saving.
    608   // |shouldReturnLocalPath| true if paths need to be resolved to local paths.
    609   // |callback|
    610   static void selectFile(DOMString selectedPath,
    611                          long index,
    612                          boolean forOpening,
    613                          boolean shouldReturnLocalPath,
    614                          SimpleCallback callback);
    615 
    616   // Requests Drive file properties for files.
    617   // |fileUrls| list of URLs of files
    618   // |callback|
    619   static void getDriveEntryProperties(
    620       DOMString[] fileUrls,
    621       GetDriveEntryPropertiesCallback callback);
    622 
    623   // Pins/unpins a Drive file in the cache.
    624   // |fileUrl| URL of a file to pin/unpin.
    625   // |pin| Pass true to pin the file.
    626   // |callback| Completion callback. $(ref:runtime.lastError) will be set if
    627   //     there was an error.
    628   static void pinDriveFile(DOMString fileUrl,
    629                            boolean pin,
    630                            optional SimpleCallback callback);
    631 
    632   // Get Drive files.
    633   // |fileUrls| Array of Drive file URLs to get.
    634   // |callback|
    635   static void getDriveFiles(DOMString[] fileUrls,
    636                             GetDriveFilesCallback callback);
    637 
    638   // Resolves file entries in the isolated file system and returns corresponding
    639   // entries in the external file system mounted to Chrome OS file manager
    640   // backend. If resolving entry fails, the entry will be just ignored and the
    641   // corresponding entry does not appear in the result.
    642   [nocompile]
    643   static void resolveIsolatedEntries(
    644       [instanceOf=FileEntry] object[] entries,
    645       ResolveEntriesCallback callback);
    646 
    647   // Mount a resource or a file.
    648   // |source| Mount point source. For compressed files it is relative file path
    649   //     within external file system
    650   // |callback|
    651   static void addMount(DOMString source, AddMountCallback callback);
    652 
    653   // Unmounts a mounted resource.
    654   // |volumeId| An ID of the volume.
    655   static void removeMount(DOMString volumeId);
    656 
    657   // Get the list of mounted volumes.
    658   // |callback|
    659   static void getVolumeMetadataList(GetVolumeMetadataListCallback callback);
    660 
    661   // Cancels ongoing file transfers for selected files.
    662   // |fileUrls| Array of files for which ongoing transfer should be canceled.
    663   // |callback|
    664   static void cancelFileTransfers(DOMString[] fileUrls,
    665                                   CancelFileTransfersCallback callback);
    666 
    667   // Starts to copy an entry. If the source is a directory, the copy is done
    668   // recursively.
    669   // |sourceUrl| URL of the source entry to be copied.
    670   // |parent| URL of the destination directory.
    671   // |newName| Name of the new entry. It shouldn't contain '/'.
    672   // |callback| Completion callback.
    673   static void startCopy(DOMString sourceUrl,
    674                         DOMString parent,
    675                         DOMString newName,
    676                         StartCopyCallback callback);
    677 
    678   // Cancels the running copy task.
    679   // |copyId| ID of the copy task to be cancelled.
    680   // |callback| Completion callback of the cancel.
    681   static void cancelCopy(long copyId, optional SimpleCallback callback);
    682 
    683   // Retrieves total and remaining size of a mount point.
    684   // |volumeId| ID of the volume to be checked.
    685   // |callback|
    686   static void getSizeStats(DOMString volumeId, GetSizeStatsCallback callback);
    687 
    688   // Formats a mounted volume.
    689   // |volumeId| ID of the volume to be formatted.
    690   static void formatVolume(DOMString volumeId);
    691 
    692   // Retrieves file manager preferences.
    693   // |callback|
    694   static void getPreferences(GetPreferencesCallback callback);
    695 
    696   // Sets file manager preferences.
    697   // |changeInfo|
    698   static void setPreferences(PreferencesChange changeInfo);
    699 
    700   // Performs drive content search.
    701   // |searchParams|
    702   // |callback|
    703   static void searchDrive(SearchParams searchParams,
    704                           SearchDriveCallback callback);
    705 
    706   // Performs drive metadata search.
    707   // |searchParams|
    708   // |callback|
    709   static void searchDriveMetadata(SearchMetadataParams searchParams,
    710                                   SearchDriveMetadataCallback callback);
    711 
    712   // Create a zip file for the selected files.
    713   // |dirURL| URL of the directory containing the selected files.
    714   // |selectionUrls| URLs of the selected files. The files must be under the
    715   //     directory specified by dirURL.
    716   // |destName| Name of the destination zip file. The zip file will be created
    717   //     under the directory specified by dirURL.
    718   // |callback|
    719   static void zipSelection(DOMString dirURL,
    720                            DOMString[] selectionUrls,
    721                            DOMString destName,
    722                            optional ZipSelectionCallback callback);
    723 
    724   // Retrieves the state of the current drive connection.
    725   // |callback|
    726   static void getDriveConnectionState(GetDriveConnectionStateCallback callback);
    727 
    728   // Checks whether the path name length fits in the limit of the filesystem.
    729   // |parent_directory_url| The URL of the parent directory entry.
    730   // |name| The name of the file.
    731   // |callback| Called back when the check is finished.
    732   static void validatePathNameLength(DOMString parent_directory_url,
    733                                      DOMString name,
    734                                      ValidatePathNameLengthCallback callback);
    735 
    736   // Changes the zoom factor of the Files.app.
    737   // |operation| Zooming mode.
    738   static void zoom(ZoomOperationType operation);
    739 
    740   // Requests a Drive API OAuth2 access token.
    741   // |refresh| Whether the token should be refetched instead of using the cached
    742   //     one.
    743   // |callback|
    744   static void requestAccessToken(boolean refresh,
    745                                  RequestAccessTokenCallback callback);
    746 
    747   // Requests a Webstore API OAuth2 access token.
    748   // |callback|
    749   static void requestWebStoreAccessToken(
    750       RequestWebStoreAccessTokenCallback callback);
    751 
    752   // Requests a share dialog url for the specified file.
    753   // |url| Url for the file.
    754   // |callback|
    755   static void getShareUrl(DOMString url, GetShareUrlCallback callback);
    756 
    757   // Requests to share drive files.
    758   // |url| URL of a file to be shared.
    759   // |shareType| Type of access that is getting granted.
    760   static void requestDriveShare(DOMString url,
    761                                 DriveShareType shareType,
    762                                 SimpleCallback callback);
    763 
    764   // Requests to install a webstore item.
    765   // |item_id| The id of the item to install.
    766   // |callback|
    767   static void installWebstoreItem(DOMString item_id,
    768                                   SimpleCallback callback);
    769 
    770   // Obtains a list of profiles that are logged-in.
    771   static void getProfiles(GetProfilesCallback callback);
    772 
    773   // Moves the window to other user's desktop.
    774   static void visitDesktop(DOMString profileId,
    775                            optional SimpleCallback callback);
    776 
    777   // Opens inspector window.
    778   // |type| InspectionType which specifies how to open inspector.
    779   static void openInspector(InspectionType type);
    780 };
    781 
    782 interface Events {
    783   static void onMountCompleted(MountCompletedEvent event);
    784 
    785   static void onFileTransfersUpdated(FileTransferStatus[] event);
    786 
    787   static void onCopyProgress(long copyId, CopyProgressStatus status);
    788 
    789   static void onDirectoryChanged(FileWatchEvent event);
    790 
    791   static void onPreferencesChanged();
    792 
    793   static void onDriveConnectionStatusChanged();
    794 
    795   static void onDeviceChanged(DeviceEvent event);
    796 
    797   static void onDriveSyncError(DriveSyncErrorEvent event);
    798 
    799   // Dispatched when a profile is added.
    800   static void onProfileAdded();
    801 
    802   // Dispatched when any window moves another desktop.
    803   // TODO(hirono): Add information which window is moved.
    804   static void onDesktopChanged();
    805 };
    806 };
    807