| 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/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 base::string16 UninstallView::GetItemAt(int index) { | 162 base::string16 UninstallView::GetItemAt(int index) { |
| 163 DCHECK_LT(index, static_cast<int>(browsers_->size())); | 163 DCHECK_LT(index, static_cast<int>(browsers_->size())); |
| 164 BrowsersMap::const_iterator i = browsers_->begin(); | 164 BrowsersMap::const_iterator i = browsers_->begin(); |
| 165 std::advance(i, index); | 165 std::advance(i, index); |
| 166 return i->first; | 166 return i->first; |
| 167 } | 167 } |
| 168 | 168 |
| 169 namespace chrome { | 169 namespace chrome { |
| 170 | 170 |
| 171 int ShowUninstallBrowserPrompt(bool show_delete_profile) { | 171 int ShowUninstallBrowserPrompt(bool show_delete_profile) { |
| 172 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 172 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 173 int result = content::RESULT_CODE_NORMAL_EXIT; | 173 int result = content::RESULT_CODE_NORMAL_EXIT; |
| 174 views::AcceleratorHandler accelerator_handler; | 174 views::AcceleratorHandler accelerator_handler; |
| 175 | 175 |
| 176 // Take a reference on g_browser_process while showing the dialog. This is | 176 // Take a reference on g_browser_process while showing the dialog. This is |
| 177 // done because the dialog uses the views framework which may increment | 177 // done because the dialog uses the views framework which may increment |
| 178 // and decrement the module ref count during the course of displaying UI and | 178 // and decrement the module ref count during the course of displaying UI and |
| 179 // this code can be called while the module refcount is still at 0. | 179 // this code can be called while the module refcount is still at 0. |
| 180 // Note that this reference is never released, as this code is shown on a path | 180 // Note that this reference is never released, as this code is shown on a path |
| 181 // that immediately exits Chrome anyway. | 181 // that immediately exits Chrome anyway. |
| 182 // See http://crbug.com/241366 for details. | 182 // See http://crbug.com/241366 for details. |
| 183 g_browser_process->AddRefModule(); | 183 g_browser_process->AddRefModule(); |
| 184 | 184 |
| 185 base::RunLoop run_loop(&accelerator_handler); | 185 base::RunLoop run_loop(&accelerator_handler); |
| 186 UninstallView* view = new UninstallView(&result, | 186 UninstallView* view = new UninstallView(&result, |
| 187 run_loop.QuitClosure(), | 187 run_loop.QuitClosure(), |
| 188 show_delete_profile); | 188 show_delete_profile); |
| 189 views::DialogDelegate::CreateDialogWidget(view, NULL, NULL)->Show(); | 189 views::DialogDelegate::CreateDialogWidget(view, NULL, NULL)->Show(); |
| 190 run_loop.Run(); | 190 run_loop.Run(); |
| 191 return result; | 191 return result; |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace chrome | 194 } // namespace chrome |
| OLD | NEW |