/
file_manager_private.clj
1177 lines (909 loc) · 49.2 KB
/
file_manager_private.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(ns chromex.app.file-manager-private
"fileManagerPrivate API.
This is a private API used by the file browser of ChromeOS.
* available since Chrome 39"
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
[chromex.callgen :refer [gen-call-helper gen-tap-all-events-call]]))
(declare api-table)
(declare gen-call)
; -- functions --------------------------------------------------------------------------------------------------------------
(defmacro logout-user-for-reauthentication
"Logout the current user for navigating to the re-authentication screen for the Google account."
([] (gen-call :function ::logout-user-for-reauthentication &form)))
(defmacro cancel-dialog
"Cancels file selection."
([] (gen-call :function ::cancel-dialog &form)))
(defmacro execute-task
"Executes file browser task over selected files. |taskId| The unique identifier of task to execute. |entries| Array of
entries |callback
|task-id| - ?
|entries| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([task-id entries] (gen-call :function ::execute-task &form task-id entries)))
(defmacro set-default-task
"Sets the default task for the supplied MIME types and path extensions. Lists of MIME types and URLs may contain duplicates.
Additionally, the list of MIME types can be empty. |taskId| The unique identifier of task to mark as default. |entries
Array of selected entries to extract path extensions from. |mimeTypes| Array of selected file MIME types. |callback
|task-id| - ?
|entries| - ?
|mime-types| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([task-id entries mime-types] (gen-call :function ::set-default-task &form task-id entries mime-types)))
(defmacro get-file-tasks
"Gets the list of tasks that can be performed over selected files. |entries| Array of selected entries |callback
|entries| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [tasks] where:
|tasks| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries] (gen-call :function ::get-file-tasks &form entries)))
(defmacro get-mime-type
"Gets the MIME type of a file. |entry| Entry to be checked. |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::get-mime-type &form entry)))
(defmacro get-strings
"Gets localized strings and initialization data. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-strings &form)))
(defmacro add-file-watch
"Adds file watch. |entry| Entry to watch |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [success] where:
|success| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::add-file-watch &form entry)))
(defmacro remove-file-watch
"Removes file watch. |entry| Watched entry |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [success] where:
|success| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::remove-file-watch &form entry)))
(defmacro enable-external-file-scheme
"Enables the extenal file scheme necessary to initiate drags to the browser window for files on the external backend."
([] (gen-call :function ::enable-external-file-scheme &form)))
(defmacro grant-access
"Requests granting R/W permissions for the passed entries. It's a best effort operation. Some files may not be granted
access if the url is invalid or not backed by the external file system. |entryUrls| Urls for the entries to be accessed.
|callback
|entry-urls| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry-urls] (gen-call :function ::grant-access &form entry-urls)))
(defmacro select-files
"Selects multiple files. |selectedPaths| Array of selected paths |shouldReturnLocalPath| true if paths need to be resolved
to local paths. |callback
|selected-paths| - ?
|should-return-local-path| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([selected-paths should-return-local-path] (gen-call :function ::select-files &form selected-paths should-return-local-path)))
(defmacro select-file
"Selects a file. |selectedPath| A selected path |index| Index of Filter |forOpening| true if paths are selected for opening.
false if for saving. |shouldReturnLocalPath| true if paths need to be resolved to local paths. |callback
|selected-path| - ?
|index| - ?
|for-opening| - ?
|should-return-local-path| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([selected-path index for-opening should-return-local-path] (gen-call :function ::select-file &form selected-path index for-opening should-return-local-path)))
(defmacro get-entry-properties
"Requests additional properties for files. |entries| list of entries |names| list of requested properties by their names.
|callback| Completion callback. May return less than requested properties if some are not available. In the same time,
it can return properties which were not requested (if it's cheap to compute them).
|entries| - ?
|names| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [entry-properties] where:
|entry-properties| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries names] (gen-call :function ::get-entry-properties &form entries names)))
(defmacro pin-drive-file
"Pins/unpins a Drive file in the cache. |entry| Entry to pin/unpin. |pin| Pass true to pin the file. |callback| Completion
callback. 'runtime.lastError' will be set if there was an error.
|entry| - ?
|pin| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry pin] (gen-call :function ::pin-drive-file &form entry pin)))
(defmacro ensure-file-downloaded
"If |entry| is a Drive file, ensures the file is downloaded to the cache. Otherwise, finishes immediately in success. For
example, when the file is under Downloads, MTP, removeable media, or provided by extensions for other cloud storage
services than Google Drive, this does nothing. This is a workaround to avoid intermittent and duplicated downloading of a
Drive file by current implementation of Drive integration when an extension reads a file sequentially but intermittently.
|entry| A regular file entry to be read. |callback| Callback called after having the file in cache. 'runtime.lastError'
will be set if there was an error.
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::ensure-file-downloaded &form entry)))
(defmacro resolve-isolated-entries
"Resolves entries in the isolated file system and returns corresponding entries in the external file system mounted to
Chrome OS file manager backend. If resolving entry fails, the entry will be just ignored and the corresponding entry does
not appear in the result.
|entries| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [entries] where:
|entries| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries] (gen-call :function ::resolve-isolated-entries &form entries)))
(defmacro add-mount
"Mount a resource or a file. |source| Mount point source. For compressed files it is relative file path within external
file system |callback
|source| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [source-path] where:
|source-path| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([source] (gen-call :function ::add-mount &form source)))
(defmacro remove-mount
"Unmounts a mounted resource. |volumeId| An ID of the volume.
|volume-id| - ?"
([volume-id] (gen-call :function ::remove-mount &form volume-id)))
(defmacro mark-cache-as-mounted
"Marks a cache file of Drive as mounted or unmounted. Does nothing if the file is not under Drive directory. |sourcePath
Mounted source file. Relative file path within external file system. |isMounted| Mark as mounted if true. Mark as
unmounted otherwise. |callback| Completion callback. 'runtime.lastError' will be set if there was an error.
|source-path| - ?
|is-mounted| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([source-path is-mounted] (gen-call :function ::mark-cache-as-mounted &form source-path is-mounted)))
(defmacro get-volume-metadata-list
"Get the list of mounted volumes. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [volume-metadata-list] where:
|volume-metadata-list| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-volume-metadata-list &form)))
(defmacro cancel-file-transfers
"Cancels ongoing file transfers for selected files. |entries| Array of files for which ongoing transfer should be canceled.
|callback| Completion callback of the cancel.
|entries| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries] (gen-call :function ::cancel-file-transfers &form entries)))
(defmacro cancel-all-file-transfers
"Cancels all ongoing file transfers. |callback| Completion callback of the cancel.
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::cancel-all-file-transfers &form)))
(defmacro start-copy
"Starts to copy an entry. If the source is a directory, the copy is done recursively. |entry| Entry of the source entry to
be copied. |parentEntry| Entry for the destination (parent) directory. |newName| Name of the new entry. It must not contain
'/'. |callback| Completion callback.
|entry| - ?
|parent-entry| - ?
|new-name| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [copy-id] where:
|copy-id| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry parent-entry new-name] (gen-call :function ::start-copy &form entry parent-entry new-name)))
(defmacro cancel-copy
"Cancels the running copy task. |copyId| ID of the copy task to be cancelled. |callback| Completion callback of the cancel.
|copy-id| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([copy-id] (gen-call :function ::cancel-copy &form copy-id)))
(defmacro get-size-stats
"Retrieves total and remaining size of a mount point. |volumeId| ID of the volume to be checked. |callback
|volume-id| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [size-stats] where:
|size-stats| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([volume-id] (gen-call :function ::get-size-stats &form volume-id)))
(defmacro format-volume
"Formats a mounted volume. |volumeId| ID of the volume to be formatted.
|volume-id| - ?"
([volume-id] (gen-call :function ::format-volume &form volume-id)))
(defmacro rename-volume
"Renames a mounted volume. |volumeId| ID of the volume to be renamed. |newName| New name of the target volume.
|volume-id| - ?
|new-name| - ?"
([volume-id new-name] (gen-call :function ::rename-volume &form volume-id new-name)))
(defmacro get-preferences
"Retrieves file manager preferences. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-preferences &form)))
(defmacro set-preferences
"Sets file manager preferences. |changeInfo
|change-info| - ?"
([change-info] (gen-call :function ::set-preferences &form change-info)))
(defmacro search-drive
"Performs drive content search. |searchParams| |callback
|search-params| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [entries next-feed] where:
|entries| - ?
|next-feed| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([search-params] (gen-call :function ::search-drive &form search-params)))
(defmacro search-drive-metadata
"Performs drive metadata search. |searchParams| |callback
|search-params| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [results] where:
|results| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([search-params] (gen-call :function ::search-drive-metadata &form search-params)))
(defmacro search-files-by-hashes
"Search files in the volume having |volumeId| by using |hashList|. sub-directories) the given |targetDirectoryUrl|.
|volume-id| - ?
|hash-list| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [urls] where:
|urls| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([volume-id hash-list] (gen-call :function ::search-files-by-hashes &form volume-id hash-list)))
(defmacro zip-selection
"Create a zip file for the selected files. |parentEntry| Entry of the directory containing the selected files. |entries
Entries of the selected files. The files must be under the directory specified by |parentEntry|. |destName| Name of the
destination zip file. The zip file will be created under the directory specified by |parentEntry|. |callback
|entries| - ?
|parent-entry| - ?
|dest-name| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [success] where:
|success| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries parent-entry dest-name] (gen-call :function ::zip-selection &form entries parent-entry dest-name)))
(defmacro get-drive-connection-state
"Retrieves the state of the current drive connection. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-drive-connection-state &form)))
(defmacro validate-path-name-length
"Checks whether the path name length fits in the limit of the filesystem. |parentEntry| The entry of the parent directory
entry. |name| The name of the file. |callback| Called back when the check is finished.
|parent-entry| - ?
|name| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([parent-entry name] (gen-call :function ::validate-path-name-length &form parent-entry name)))
(defmacro zoom
"Changes the zoom factor of the Files app. |operation| Zooming mode.
|operation| - ?"
([operation] (gen-call :function ::zoom &form operation)))
(defmacro request-access-token
"Requests a Drive API OAuth2 access token. |refresh| Whether the token should be refetched instead of using the cached
one. |callback
|refresh| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [access-token] where:
|access-token| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([refresh] (gen-call :function ::request-access-token &form refresh)))
(defmacro request-web-store-access-token
"Requests a Webstore API OAuth2 access token. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [access-token] where:
|access-token| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::request-web-store-access-token &form)))
(defmacro get-share-url
"Requests a share dialog url for the specified file. |entry| The entry to share. |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [url] where:
|url| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::get-share-url &form entry)))
(defmacro get-download-url
"Requests a download url to download the file contents. |entry| The entry to download. |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [url] where:
|url| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::get-download-url &form entry)))
(defmacro request-drive-share
"Requests to share drive files. |entry| Entry to be shared. |shareType| Type of access that is getting granted.
|entry| - ?
|share-type| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry share-type] (gen-call :function ::request-drive-share &form entry share-type)))
(defmacro get-profiles
"Obtains a list of profiles that are logged-in.
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [profiles running-profile display-profile] where:
|profiles| - ?
|running-profile| - ?
|display-profile| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-profiles &form)))
(defmacro open-inspector
"Opens inspector window. |type| InspectionType which specifies how to open inspector.
|type| - ?"
([type] (gen-call :function ::open-inspector &form type)))
(defmacro open-settings-subpage
"Opens page in Settings window. |sub_page| Name of a sub_page to show.
|sub-page| - ?"
([sub-page] (gen-call :function ::open-settings-subpage &form sub-page)))
(defmacro compute-checksum
"Computes an MD5 checksum for the given file. |entry| The entry of the file to checksum. |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [checksum] where:
|checksum| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::compute-checksum &form entry)))
(defmacro is-uma-enabled
"Is UMA enabled?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::is-uma-enabled &form)))
(defmacro set-entry-tag
"Sets a tag on a file or a directory. Only Drive files are supported.
|entry| - ?
|visibility| - ?
|key| - ?
|value| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry visibility key value] (gen-call :function ::set-entry-tag &form entry visibility key value)))
(defmacro is-piex-loader-enabled
"Returns if Piex loader is enabled.
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::is-piex-loader-enabled &form)))
(defmacro get-providers
"Returns list of available providers.
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [extensions] where:
|extensions| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::get-providers &form)))
(defmacro add-provided-file-system
"Requests adding a new provided file system. If not possible, then an error via chrome.runtime.lastError is returned.
|provider-id| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([provider-id] (gen-call :function ::add-provided-file-system &form provider-id)))
(defmacro configure-volume
"Requests configuring an existing volume. If not possible, then returns an error via chrome.runtime.lastError.
|volume-id| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([volume-id] (gen-call :function ::configure-volume &form volume-id)))
(defmacro get-custom-actions
"Requests list of custom actions for the specified entries. If not possible, then an error via chrome.runtime.lastError is
returned.
|entries| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [actions] where:
|actions| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries] (gen-call :function ::get-custom-actions &form entries)))
(defmacro execute-custom-action
"Executes a custom action for a set of entries. If not possible, then an error via chrome.runtime.lastError is returned.
|entries| - ?
|action-id| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entries action-id] (gen-call :function ::execute-custom-action &form entries action-id)))
(defmacro get-directory-size
"Get the total size of a directory. |entry| Entry of the target directory. |callback
|entry| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [size] where:
|size| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([entry] (gen-call :function ::get-directory-size &form entry)))
(defmacro get-recent-files
"Gets recently modified files across file systems. |restriction| Flag to restrict sources of recent files. |callback
|restriction| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [entries] where:
|entries| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([restriction] (gen-call :function ::get-recent-files &form restriction)))
(defmacro is-crostini-enabled
"Returns true if crostini is enabled. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - ?
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::is-crostini-enabled &form)))
(defmacro mount-crostini-container
"Starts and mounts crostini container. |callback
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([] (gen-call :function ::mount-crostini-container &form)))
; -- events -----------------------------------------------------------------------------------------------------------------
;
; docs: https://github.com/binaryage/chromex/#tapping-events
(defmacro tap-on-mount-completed-events
"
Events will be put on the |channel| with signature [::on-mount-completed [event]] where:
|event| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-mount-completed &form channel args)))
(defmacro tap-on-file-transfers-updated-events
"
Events will be put on the |channel| with signature [::on-file-transfers-updated [event]] where:
|event| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-file-transfers-updated &form channel args)))
(defmacro tap-on-copy-progress-events
"
Events will be put on the |channel| with signature [::on-copy-progress [copy-id status]] where:
|copy-id| - ?
|status| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-copy-progress &form channel args)))
(defmacro tap-on-directory-changed-events
"
Events will be put on the |channel| with signature [::on-directory-changed [event]] where:
|event| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-directory-changed &form channel args)))
(defmacro tap-on-preferences-changed-events
"
Events will be put on the |channel| with signature [::on-preferences-changed []].
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-preferences-changed &form channel args)))
(defmacro tap-on-drive-connection-status-changed-events
"
Events will be put on the |channel| with signature [::on-drive-connection-status-changed []].
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-drive-connection-status-changed &form channel args)))
(defmacro tap-on-device-changed-events
"
Events will be put on the |channel| with signature [::on-device-changed [event]] where:
|event| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-device-changed &form channel args)))
(defmacro tap-on-drive-sync-error-events
"
Events will be put on the |channel| with signature [::on-drive-sync-error [event]] where:
|event| - ?
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-drive-sync-error &form channel args)))
(defmacro tap-on-apps-updated-events
"
Events will be put on the |channel| with signature [::on-apps-updated []].
Note: |args| will be passed as additional parameters into Chrome event's .addListener call."
([channel & args] (apply gen-call :event ::on-apps-updated &form channel args)))
; -- convenience ------------------------------------------------------------------------------------------------------------
(defmacro tap-all-events
"Taps all valid non-deprecated events in chromex.app.file-manager-private namespace."
[chan]
(gen-tap-all-events-call api-table (meta &form) chan))
; ---------------------------------------------------------------------------------------------------------------------------
; -- API TABLE --------------------------------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------------------------------------------
(def api-table
{:namespace "chrome.fileManagerPrivate",
:since "39",
:functions
[{:id ::logout-user-for-reauthentication, :name "logoutUserForReauthentication"}
{:id ::cancel-dialog, :name "cancelDialog"}
{:id ::execute-task,
:name "executeTask",
:callback? true,
:params
[{:name "task-id", :type "string"}
{:name "entries", :type "[array-of-objects]"}
{:name "callback", :type :callback, :callback {:params [{:name "result", :type "unknown-type"}]}}]}
{:id ::set-default-task,
:name "setDefaultTask",
:callback? true,
:params
[{:name "task-id", :type "string"}
{:name "entries", :type "[array-of-objects]"}
{:name "mime-types", :type "[array-of-strings]"}
{:name "callback", :type :callback}]}
{:id ::get-file-tasks,
:name "getFileTasks",
:callback? true,
:params
[{:name "entries", :type "[array-of-objects]"}
{:name "callback", :type :callback, :callback {:params [{:name "tasks", :type "[array-of-objects]"}]}}]}
{:id ::get-mime-type,
:name "getMimeType",
:since "41",
:callback? true,
:params
[{:name "entry", :type "object"}
{:name "callback", :type :callback, :callback {:params [{:name "result", :type "string"}]}}]}
{:id ::get-strings,
:name "getStrings",
:callback? true,
:params [{:name "callback", :type :callback, :callback {:params [{:name "result", :type "object"}]}}]}
{:id ::add-file-watch,
:name "addFileWatch",
:callback? true,
:params
[{:name "entry", :type "object"}
{:name "callback", :type :callback, :callback {:params [{:name "success", :optional? true, :type "boolean"}]}}]}
{:id ::remove-file-watch,
:name "removeFileWatch",
:callback? true,
:params
[{:name "entry", :type "object"}
{:name "callback", :type :callback, :callback {:params [{:name "success", :optional? true, :type "boolean"}]}}]}
{:id ::enable-external-file-scheme, :name "enableExternalFileScheme", :since "43"}
{:id ::grant-access,
:name "grantAccess",
:since "43",
:callback? true,
:params [{:name "entry-urls", :type "[array-of-strings]"} {:name "callback", :type :callback}]}
{:id ::select-files,
:name "selectFiles",
:callback? true,
:params
[{:name "selected-paths", :type "[array-of-strings]"}
{:name "should-return-local-path", :type "boolean"}
{:name "callback", :type :callback}]}
{:id ::select-file,
:name "selectFile",
:callback? true,
:params
[{:name "selected-path", :type "string"}
{:name "index", :type "integer"}
{:name "for-opening", :type "boolean"}
{:name "should-return-local-path", :type "boolean"}
{:name "callback", :type :callback}]}
{:id ::get-entry-properties,
:name "getEntryProperties",
:callback? true,
:params
[{:name "entries", :type "[array-of-Entrys]"}
{:name "names", :type "[array-of-unknown-types]"}
{:name "callback",
:type :callback,
:callback {:params [{:name "entry-properties", :type "[array-of-objects]"}]}}]}
{:id ::pin-drive-file,
:name "pinDriveFile",
:callback? true,
:params [{:name "entry", :type "object"} {:name "pin", :type "boolean"} {:name "callback", :type :callback}]}
{:id ::ensure-file-downloaded,
:name "ensureFileDownloaded",
:since "67",
:callback? true,
:params [{:name "entry", :type "object"} {:name "callback", :type :callback}]}
{:id ::resolve-isolated-entries,
:name "resolveIsolatedEntries",
:callback? true,
:params
[{:name "entries", :type "[array-of-Entrys]"}
{:name "callback", :type :callback, :callback {:params [{:name "entries", :type "[array-of-Entrys]"}]}}]}
{:id ::add-mount,
:name "addMount",
:callback? true,
:params
[{:name "source", :type "string"}
{:name "callback", :type :callback, :callback {:params [{:name "source-path", :type "string"}]}}]}
{:id ::remove-mount, :name "removeMount", :params [{:name "volume-id", :type "string"}]}
{:id ::mark-cache-as-mounted,
:name "markCacheAsMounted",
:since "67",
:callback? true,
:params
[{:name "source-path", :type "string"} {:name "is-mounted", :type "boolean"} {:name "callback", :type :callback}]}
{:id ::get-volume-metadata-list,
:name "getVolumeMetadataList",
:callback? true,
:params
[{:name "callback",
:type :callback,
:callback {:params [{:name "volume-metadata-list", :type "[array-of-fileManagerPrivate.VolumeMetadatas]"}]}}]}
{:id ::cancel-file-transfers,
:name "cancelFileTransfers",
:callback? true,
:params [{:name "entries", :type "[array-of-objects]"} {:name "callback", :type :callback}]}
{:id ::cancel-all-file-transfers,
:name "cancelAllFileTransfers",
:since "46",
:callback? true,
:params [{:name "callback", :type :callback}]}
{:id ::start-copy,
:name "startCopy",
:callback? true,
:params
[{:name "entry", :type "object"}
{:name "parent-entry", :type "object"}
{:name "new-name", :type "string"}
{:name "callback", :type :callback, :callback {:params [{:name "copy-id", :type "integer"}]}}]}
{:id ::cancel-copy,
:name "cancelCopy",
:callback? true,
:params [{:name "copy-id", :type "integer"} {:name "callback", :type :callback}]}
{:id ::get-size-stats,
:name "getSizeStats",
:callback? true,
:params
[{:name "volume-id", :type "string"}
{:name "callback",
:type :callback,
:callback {:params [{:name "size-stats", :optional? true, :type "object"}]}}]}
{:id ::format-volume, :name "formatVolume", :params [{:name "volume-id", :type "string"}]}
{:id ::rename-volume,
:name "renameVolume",
:since "62",
:params [{:name "volume-id", :type "string"} {:name "new-name", :type "string"}]}
{:id ::get-preferences,
:name "getPreferences",
:callback? true,
:params [{:name "callback", :type :callback, :callback {:params [{:name "result", :type "object"}]}}]}
{:id ::set-preferences, :name "setPreferences", :params [{:name "change-info", :type "object"}]}
{:id ::search-drive,
:name "searchDrive",
:callback? true,
:params
[{:name "search-params", :type "object"}
{:name "callback",
:type :callback,
:callback {:params [{:name "entries", :type "[array-of-Entrys]"} {:name "next-feed", :type "string"}]}}]}
{:id ::search-drive-metadata,
:name "searchDriveMetadata",
:callback? true,
:params
[{:name "search-params", :type "object"}