Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/uninstall_view.h" | 5 #include "chrome/browser/ui/views/uninstall_view.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/browser_process.h" | |
| 10 #include "chrome/browser/shell_integration.h" | 11 #include "chrome/browser/shell_integration.h" |
| 11 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 12 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
| 12 #include "chrome/common/chrome_result_codes.h" | 13 #include "chrome/common/chrome_result_codes.h" |
| 13 #include "chrome/installer/util/browser_distribution.h" | 14 #include "chrome/installer/util/browser_distribution.h" |
| 14 #include "chrome/installer/util/shell_util.h" | 15 #include "chrome/installer/util/shell_util.h" |
| 15 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/views/controls/button/checkbox.h" | 18 #include "ui/views/controls/button/checkbox.h" |
| 18 #include "ui/views/controls/combobox/combobox.h" | 19 #include "ui/views/controls/combobox/combobox.h" |
| 19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 std::advance(i, index); | 160 std::advance(i, index); |
| 160 return i->first; | 161 return i->first; |
| 161 } | 162 } |
| 162 | 163 |
| 163 namespace chrome { | 164 namespace chrome { |
| 164 | 165 |
| 165 int ShowUninstallBrowserPrompt(bool show_delete_profile) { | 166 int ShowUninstallBrowserPrompt(bool show_delete_profile) { |
| 166 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 167 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
| 167 int result = content::RESULT_CODE_NORMAL_EXIT; | 168 int result = content::RESULT_CODE_NORMAL_EXIT; |
| 168 views::AcceleratorHandler accelerator_handler; | 169 views::AcceleratorHandler accelerator_handler; |
| 170 | |
| 171 // Take a reference on g_browser_process while showing the dialog. This is | |
| 172 // done because the dialog uses the views framework which may increment | |
| 173 // and decrement the module ref count during the course of displaying UI and | |
| 174 // this code can be called while the module refcount is still at 0. | |
| 175 // Note that this reference is never released, as this code is shown on a path | |
| 176 // that immediately exits Chrome anyway. | |
| 177 // See http://crbug.com/241366 for details. | |
| 178 g_browser_process->AddRefModule(); | |
|
sky
2013/05/16 19:26:50
How does the ref count end up hitting 0 here?
| |
| 179 | |
| 169 base::RunLoop run_loop(&accelerator_handler); | 180 base::RunLoop run_loop(&accelerator_handler); |
| 170 UninstallView* view = new UninstallView(&result, | 181 UninstallView* view = new UninstallView(&result, |
| 171 run_loop.QuitClosure(), | 182 run_loop.QuitClosure(), |
| 172 show_delete_profile); | 183 show_delete_profile); |
| 173 views::Widget::CreateWindow(view)->Show(); | 184 views::Widget::CreateWindow(view)->Show(); |
| 174 run_loop.Run(); | 185 run_loop.Run(); |
| 175 return result; | 186 return result; |
| 176 } | 187 } |
| 177 | 188 |
| 178 } // namespace chrome | 189 } // namespace chrome |
| OLD | NEW |