Index: chrome/browser/ui/views/uninstall_view.cc |
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc |
index d3558eb4c47925813a9cdef09d8126664340685e..79e94b5c1e556df2af977f374495920bb6ee6562 100644 |
--- a/chrome/browser/ui/views/uninstall_view.cc |
+++ b/chrome/browser/ui/views/uninstall_view.cc |
@@ -7,7 +7,8 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/process/launch.h" |
#include "base/run_loop.h" |
-#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/lifetime/keep_alive_types.h" |
+#include "chrome/browser/lifetime/scoped_keep_alive.h" |
#include "chrome/browser/shell_integration.h" |
#include "chrome/browser/ui/uninstall_browser_prompt.h" |
#include "chrome/common/chrome_result_codes.h" |
@@ -166,14 +167,15 @@ int ShowUninstallBrowserPrompt() { |
DCHECK(base::MessageLoopForUI::IsCurrent()); |
int result = content::RESULT_CODE_NORMAL_EXIT; |
- // Take a reference on g_browser_process while showing the dialog. This is |
- // done because the dialog uses the views framework which may increment |
- // and decrement the module ref count during the course of displaying UI and |
- // this code can be called while the module refcount is still at 0. |
+ // Register a KeepAlive while showing the dialog. This is done because the |
+ // dialog uses the views framework which may take and release a KeepAlive |
+ // during the course of displaying UI and this code can be called while |
+ // there is no registered KeepAlive. |
// Note that this reference is never released, as this code is shown on a path |
// that immediately exits Chrome anyway. |
// See http://crbug.com/241366 for details. |
- g_browser_process->AddRefModule(); |
+ new ScopedKeepAlive(KeepAliveOrigin::LEAKED_UNINSTALL_VIEW, |
+ KeepAliveRestartOption::DISABLED); |
base::RunLoop run_loop; |
UninstallView* view = new UninstallView(&result, |