OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_MAC_RELAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_MAC_RELAUNCHER_H_ |
6 #define CHROME_BROWSER_MAC_RELAUNCHER_H_ | 6 #define CHROME_BROWSER_MAC_RELAUNCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // mac_relauncher implements main browser application relaunches on the Mac. | 9 // mac_relauncher implements main browser application relaunches on the Mac. |
10 // When a browser wants to relaunch itself, it can't simply fork off a new | 10 // When a browser wants to relaunch itself, it can't simply fork off a new |
(...skipping 19 matching lines...) Expand all Loading... |
30 // in light of PID reuse, so the parent must remain alive long enough for the | 30 // in light of PID reuse, so the parent must remain alive long enough for the |
31 // relauncher to set up its kqueue. | 31 // relauncher to set up its kqueue. |
32 | 32 |
33 #include <string> | 33 #include <string> |
34 #include <vector> | 34 #include <vector> |
35 | 35 |
36 struct MainFunctionParams; | 36 struct MainFunctionParams; |
37 | 37 |
38 namespace mac_relauncher { | 38 namespace mac_relauncher { |
39 | 39 |
| 40 // The relauncher process can unmount and eject a mounted disk image and move |
| 41 // its disk image file to the trash. This argument may be supplied to |
| 42 // RelaunchAppWithHelper to achieve this. The argument's value must be a BSD |
| 43 // device name of the form "diskN" or "diskNsM". |
| 44 extern const char* const kRelauncherDMGDeviceArg; |
| 45 |
40 // Relaunches the application using the helper application associated with the | 46 // Relaunches the application using the helper application associated with the |
41 // currently running instance of Chrome in the parent browser process as the | 47 // currently running instance of Chrome in the parent browser process as the |
42 // executable for the relauncher process. |args| is an argv-style vector of | 48 // executable for the relauncher process. |args| is an argv-style vector of |
43 // command line arguments of the form normally passed to execv. args[0] is | 49 // command line arguments of the form normally passed to execv. args[0] is |
44 // also the path to the relaunched process. Because the relauncher process | 50 // also the path to the relaunched process. Because the relauncher process |
45 // will ultimately launch the relaunched process via Launch Services, args[0] | 51 // will ultimately launch the relaunched process via Launch Services, args[0] |
46 // may be either a pathname to an executable file or a pathname to an .app | 52 // may be either a pathname to an executable file or a pathname to an .app |
47 // bundle directory. The caller should exit soon after RelaunchApp returns | 53 // bundle directory. The caller should exit soon after RelaunchApp returns |
48 // successfully. Returns true on success, although some failures can occur | 54 // successfully. Returns true on success, although some failures can occur |
49 // after this function returns true if, for example, they occur within the | 55 // after this function returns true if, for example, they occur within the |
50 // relauncher process. Returns false when the relaunch definitely failed. | 56 // relauncher process. Returns false when the relaunch definitely failed. |
51 bool RelaunchApp(const std::vector<std::string>& args); | 57 bool RelaunchApp(const std::vector<std::string>& args); |
52 | 58 |
53 // Identical to RelaunchApp, but uses |helper| as the path to the relauncher | 59 // Identical to RelaunchApp, but uses |helper| as the path to the relauncher |
54 // process. Unlike args[0], |helper| must be a pathname to an executable file. | 60 // process, and allows additional arguments to be supplied to the relauncher |
55 // The helper path given must be from the same version of Chrome as the | 61 // process in relauncher_args. Unlike args[0], |helper| must be a pathname to |
56 // running parent browser process, as there are no guarantees that the parent | 62 // an executable file. The helper path given must be from the same version of |
57 // and relauncher processes from different versions will be able to | 63 // Chrome as the running parent browser process, as there are no guarantees |
58 // communicate with one another. This variant can be useful to relaunch the | 64 // that the parent and relauncher processes from different versions will be |
59 // same version of Chrome from another location, using that location's helper. | 65 // able to communicate with one another. This variant can be useful to |
| 66 // relaunch the same version of Chrome from another location, using that |
| 67 // location's helper. |
60 bool RelaunchAppWithHelper(const std::string& helper, | 68 bool RelaunchAppWithHelper(const std::string& helper, |
| 69 const std::vector<std::string>& relauncher_args, |
61 const std::vector<std::string>& args); | 70 const std::vector<std::string>& args); |
62 | 71 |
63 namespace internal { | 72 namespace internal { |
64 | 73 |
65 // The entry point from ChromeMain into the relauncher process. This is not a | 74 // The entry point from ChromeMain into the relauncher process. This is not a |
66 // user API. Don't call it if your name isn't ChromeMain. | 75 // user API. Don't call it if your name isn't ChromeMain. |
67 int RelauncherMain(const MainFunctionParams& main_parameters); | 76 int RelauncherMain(const MainFunctionParams& main_parameters); |
68 | 77 |
69 } // namespace internal | 78 } // namespace internal |
70 | 79 |
71 } // namespace mac_relauncher | 80 } // namespace mac_relauncher |
72 | 81 |
73 #endif // CHROME_BROWSER_MAC_RELAUNCHER_H_ | 82 #endif // CHROME_BROWSER_MAC_RELAUNCHER_H_ |
OLD | NEW |