LEFT | RIGHT |
1 /** | 1 /** |
2 * \file close_application.cpp | 2 * \file close_application.cpp |
3 */ | 3 */ |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "session.h" | 7 #include "session.h" |
8 #include "property.h" | 8 #include "property.h" |
9 #include "database.h" | 9 #include "database.h" |
10 #include "process.h" | 10 #include "process.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 snapshot.Refresh(); | 34 snapshot.Refresh(); |
35 browserCloser.Refresh(); | 35 browserCloser.Refresh(); |
36 engineCloser.Refresh(); | 36 engineCloser.Refresh(); |
37 } | 37 } |
38 | 38 |
39 bool IsRunning() | 39 bool IsRunning() |
40 { | 40 { |
41 return browserCloser.IsRunning() || engineCloser.IsRunning(); | 41 return browserCloser.IsRunning() || engineCloser.IsRunning(); |
42 } | 42 } |
43 | 43 |
44 bool ShutDown() | 44 bool ShutDown(ImmediateSession& session) |
45 { | 45 { |
46 if (browserCloser.IsRunning() && !browserCloser.ShutDown()) | 46 if (browserCloser.IsRunning() && !browserCloser.ShutDown(session)) |
47 { | 47 { |
48 // Assert IE is still running | 48 // Assert IE is still running |
49 // This is after we've tried to shut it down, so we fail | 49 // This is after we've tried to shut it down, so we fail |
50 return false; | 50 return false; |
51 } | 51 } |
52 if (engineCloser.IsRunning() && !engineCloser.ShutDown()) | 52 if (engineCloser.IsRunning() && !engineCloser.ShutDown(session)) |
53 { | 53 { |
54 // Assert the engine is still running | 54 // Assert the engine is still running |
55 // This is after IE has shut down itself and after we've tried to shut dow
n the engine. Whatever. | 55 // This is after IE has shut down itself and after we've tried to shut dow
n the engine. Whatever. |
56 return false; | 56 return false; |
57 } | 57 } |
58 return true; | 58 return true; |
59 } | 59 } |
60 }; | 60 }; |
61 | 61 |
62 //------------------------------------------------------- | 62 //------------------------------------------------------- |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 * This is where we specify default behavior for non-interactive operati
on. | 221 * This is where we specify default behavior for non-interactive operati
on. |
222 * The choice of "allow" makes it act like other installers, which is to
make no effort to avoid a reboot after installation. | 222 * The choice of "allow" makes it act like other installers, which is to
make no effort to avoid a reboot after installation. |
223 */ | 223 */ |
224 state = allow; | 224 state = allow; |
225 session.Log("Reboot allowed by default in non-interactive session."); | 225 session.Log("Reboot allowed by default in non-interactive session."); |
226 } | 226 } |
227 else if (state == active) | 227 else if (state == active) |
228 { | 228 { |
229 throw std::runtime_error("AVOIDREBOOT=ACTIVE in non-interative session i
s not consistent"); | 229 throw std::runtime_error("AVOIDREBOOT=ACTIVE in non-interative session i
s not consistent"); |
230 } | 230 } |
231 // Assert state is one of { allow, passive, automatic } | 231 // Assert state is one of {allow, passive, automatic} |
232 } | 232 } |
233 else | 233 else |
234 { | 234 { |
235 throw std::runtime_error("unrecognized value for UILevel"); | 235 throw std::runtime_error("unrecognized value for UILevel"); |
236 } | 236 } |
237 | 237 |
238 /* | 238 /* |
239 * Now that preliminaries are over, we set up the accessors for UI text. | 239 * Now that preliminaries are over, we set up the accessors for UI text. |
240 * We only use the object 'messageText' for interactive sessions, but it's c
heap to set up and a hassle to conditionalize. | 240 * We only use the object 'messageText' for interactive sessions, but it's c
heap to set up and a hassle to conditionalize. |
241 * | 241 * |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 * We first shut down IE, or at least attempt to. | 361 * We first shut down IE, or at least attempt to. |
362 * | 362 * |
363 * Succeeded -> Goto success | 363 * Succeeded -> Goto success |
364 * Failed && interactive -> | 364 * Failed && interactive -> |
365 * Ask user if they would like to try again | 365 * Ask user if they would like to try again |
366 * Retry -> re-enter this state | 366 * Retry -> re-enter this state |
367 * Cancel -> Goto notKnown | 367 * Cancel -> Goto notKnown |
368 * Failed && not interactive -> Goto abort | 368 * Failed && not interactive -> Goto abort |
369 */ | 369 */ |
370 { | 370 { |
371 bool ieWasClosed = iec.ShutDown(); | 371 » bool ieWasClosed = iec.ShutDown(session); |
372 if (iec.IsRunning()) | 372 if (iec.IsRunning()) |
373 { | 373 { |
374 session.Log("Attempt to shut down IE automatically failed."); | 374 session.Log("Attempt to shut down IE automatically failed."); |
375 if (interactive) | 375 if (interactive) |
376 { | 376 { |
377 // Assert Interactive session and IE did not shut down. | 377 // Assert Interactive session and IE did not shut down. |
378 int x = session.WriteMessage(IMB( | 378 int x = session.WriteMessage(IMB( |
379 messageText.Text(L"dialog_automatic_retry"), | 379 messageText.Text(L"dialog_automatic_retry"), |
380 IMB::Box::warning, IMB::ButtonSet::retryCancel, IMB::DefaultButt
on::one)); | 380 IMB::Box::warning, IMB::ButtonSet::retryCancel, IMB::DefaultButt
on::one)); |
381 switch (x) | 381 switch (x) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 return ERROR_INSTALL_FAILURE; | 436 return ERROR_INSTALL_FAILURE; |
437 } | 437 } |
438 catch (...) | 438 catch (...) |
439 { | 439 { |
440 session.LogNoexcept("terminated by unknown exception"); | 440 session.LogNoexcept("terminated by unknown exception"); |
441 return ERROR_INSTALL_FAILURE; | 441 return ERROR_INSTALL_FAILURE; |
442 } | 442 } |
443 // Should be unreachable. | 443 // Should be unreachable. |
444 return ERROR_INSTALL_FAILURE; | 444 return ERROR_INSTALL_FAILURE; |
445 } | 445 } |
LEFT | RIGHT |