| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | // Copyright (c) 2017 GitHub, Inc.
 | 
					
						
							|  |  |  | // Use of this source code is governed by the MIT license that can be
 | 
					
						
							|  |  |  | // found in the LICENSE file.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 12:19:40 -08:00
										 |  |  | #ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_
 | 
					
						
							|  |  |  | #define SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 |  |  | #include "base/mac/foundation_util.h"
 | 
					
						
							|  |  |  | #include "shell/common/gin_helper/error_thrower.h"
 | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 |  |  | namespace gin { | 
					
						
							|  |  |  | class Arguments; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 |  |  | namespace electron { | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-15 09:34:20 -07:00
										 |  |  | // Possible bundle movement conflicts
 | 
					
						
							| 
									
										
										
										
											2020-10-27 18:51:45 +01:00
										 |  |  | enum class BundlerMoverConflictType { kExists, kExistsAndRunning }; | 
					
						
							| 
									
										
										
										
											2019-07-15 09:34:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 12:19:40 -08:00
										 |  |  | class ElectronBundleMover { | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  |  public: | 
					
						
							| 
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 |  |  |   static bool Move(gin_helper::ErrorThrower thrower, gin::Arguments* args); | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  |   static bool IsCurrentAppInApplicationsFolder(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  private: | 
					
						
							| 
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 |  |  |   static bool ShouldContinueMove(gin_helper::ErrorThrower thrower, | 
					
						
							|  |  |  |                                  BundlerMoverConflictType type, | 
					
						
							|  |  |  |                                  gin::Arguments* args); | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  |   static bool IsInApplicationsFolder(NSString* bundlePath); | 
					
						
							|  |  |  |   static NSString* ContainingDiskImageDevice(NSString* bundlePath); | 
					
						
							|  |  |  |   static void Relaunch(NSString* destinationPath); | 
					
						
							|  |  |  |   static NSString* ShellQuotedString(NSString* string); | 
					
						
							|  |  |  |   static bool CopyBundle(NSString* srcPath, NSString* dstPath); | 
					
						
							| 
									
										
										
										
											2018-04-17 21:44:10 -04:00
										 |  |  |   static bool AuthorizedInstall(NSString* srcPath, | 
					
						
							|  |  |  |                                 NSString* dstPath, | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  |                                 bool* canceled); | 
					
						
							|  |  |  |   static bool IsApplicationAtPathRunning(NSString* bundlePath); | 
					
						
							|  |  |  |   static bool DeleteOrTrash(NSString* path); | 
					
						
							|  |  |  |   static bool Trash(NSString* path); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 |  |  | }  // namespace electron
 | 
					
						
							| 
									
										
										
										
											2017-09-01 00:37:12 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 12:19:40 -08:00
										 |  |  | #endif  // SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_
 |