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/lifetime/keep_alive_types.h" | 10 #include "chrome/browser/lifetime/keep_alive_types.h" |
11 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 11 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
12 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/shell_integration.h" |
13 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 13 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
14 #include "chrome/common/chrome_result_codes.h" | 14 #include "chrome/common/chrome_result_codes.h" |
15 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
16 #include "chrome/installer/util/browser_distribution.h" | |
17 #include "chrome/installer/util/shell_util.h" | 16 #include "chrome/installer/util/shell_util.h" |
18 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/views/controls/button/checkbox.h" | 18 #include "ui/views/controls/button/checkbox.h" |
20 #include "ui/views/controls/combobox/combobox.h" | 19 #include "ui/views/controls/combobox/combobox.h" |
21 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
22 #include "ui/views/layout/grid_layout.h" | 21 #include "ui/views/layout/grid_layout.h" |
23 #include "ui/views/layout/layout_constants.h" | 22 #include "ui/views/layout/layout_constants.h" |
24 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
25 | 24 |
26 UninstallView::UninstallView(int* user_selection, | 25 UninstallView::UninstallView(int* user_selection, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)); | 72 l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)); |
74 layout->AddView(delete_profile_); | 73 layout->AddView(delete_profile_); |
75 | 74 |
76 // Set default browser combo box. If the default should not or cannot be | 75 // Set default browser combo box. If the default should not or cannot be |
77 // changed, widgets are not shown. We assume here that if Chrome cannot | 76 // changed, widgets are not shown. We assume here that if Chrome cannot |
78 // be set programatically as default, neither can any other browser (for | 77 // be set programatically as default, neither can any other browser (for |
79 // instance because the OS doesn't permit that). | 78 // instance because the OS doesn't permit that). |
80 if (ShellUtil::CanMakeChromeDefaultUnattended() && | 79 if (ShellUtil::CanMakeChromeDefaultUnattended() && |
81 shell_integration::GetDefaultBrowser() == shell_integration::IS_DEFAULT) { | 80 shell_integration::GetDefaultBrowser() == shell_integration::IS_DEFAULT) { |
82 browsers_.reset(new BrowsersMap()); | 81 browsers_.reset(new BrowsersMap()); |
83 ShellUtil::GetRegisteredBrowsers(BrowserDistribution::GetDistribution(), | 82 ShellUtil::GetRegisteredBrowsers(browsers_.get()); |
84 browsers_.get()); | |
85 if (!browsers_->empty()) { | 83 if (!browsers_->empty()) { |
86 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 84 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
87 | 85 |
88 ++column_set_id; | 86 ++column_set_id; |
89 column_set = layout->AddColumnSet(column_set_id); | 87 column_set = layout->AddColumnSet(column_set_id); |
90 column_set->AddPaddingColumn(0, views::kCheckboxIndent); | 88 column_set->AddPaddingColumn(0, views::kCheckboxIndent); |
91 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 89 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
92 GridLayout::USE_PREF, 0, 0); | 90 GridLayout::USE_PREF, 0, 0); |
93 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 91 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); |
94 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 92 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 175 |
178 base::RunLoop run_loop; | 176 base::RunLoop run_loop; |
179 UninstallView* view = new UninstallView(&result, | 177 UninstallView* view = new UninstallView(&result, |
180 run_loop.QuitClosure()); | 178 run_loop.QuitClosure()); |
181 views::DialogDelegate::CreateDialogWidget(view, NULL, NULL)->Show(); | 179 views::DialogDelegate::CreateDialogWidget(view, NULL, NULL)->Show(); |
182 run_loop.Run(); | 180 run_loop.Run(); |
183 return result; | 181 return result; |
184 } | 182 } |
185 | 183 |
186 } // namespace chrome | 184 } // namespace chrome |
OLD | NEW |