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/string16.h" | 9 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 ++column_set_id; | 62 ++column_set_id; |
63 column_set = layout->AddColumnSet(column_set_id); | 63 column_set = layout->AddColumnSet(column_set_id); |
64 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 64 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); |
65 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 65 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
66 GridLayout::USE_PREF, 0, 0); | 66 GridLayout::USE_PREF, 0, 0); |
67 layout->StartRow(0, column_set_id); | 67 layout->StartRow(0, column_set_id); |
68 delete_profile_ = new views::Checkbox( | 68 delete_profile_ = new views::Checkbox( |
69 l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)); | 69 l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)); |
70 layout->AddView(delete_profile_); | 70 layout->AddView(delete_profile_); |
71 | 71 |
72 // Set default browser combo box | 72 // Set default browser combo box. If the default should not or cannot be |
73 // changed, widgets are not shown. We assume here that if Chrome cannot | |
74 // be set programatically as default, neither can any other browser (for | |
75 // instance because the OS doesn't permit that). | |
73 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 76 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
74 if (dist->CanSetAsDefault() && | 77 if (dist->CanSetAsDefault() && |
75 ShellIntegration::IsDefaultBrowser()) { | 78 ShellIntegration::IsDefaultBrowser() && |
79 ShellIntegration::CanSetAsDefaultBrowser() != | |
Peter Kasting
2012/06/08 18:37:48
Nit: I'd put parens around this condition since it
motek.
2012/06/08 18:49:18
Done.
| |
80 ShellIntegration::SET_DEFAULT_INTERACTIVE) { | |
76 browsers_.reset(new BrowsersMap()); | 81 browsers_.reset(new BrowsersMap()); |
77 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); | 82 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); |
78 if (!browsers_->empty()) { | 83 if (!browsers_->empty()) { |
79 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 84 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
80 | 85 |
81 ++column_set_id; | 86 ++column_set_id; |
82 column_set = layout->AddColumnSet(column_set_id); | 87 column_set = layout->AddColumnSet(column_set_id); |
83 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 88 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); |
84 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 89 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
85 GridLayout::USE_PREF, 0, 0); | 90 GridLayout::USE_PREF, 0, 0); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 string16 UninstallView::GetDialogButtonLabel(ui::DialogButton button) const { | 127 string16 UninstallView::GetDialogButtonLabel(ui::DialogButton button) const { |
123 // We only want to give custom name to OK button - 'Uninstall'. Cancel | 128 // We only want to give custom name to OK button - 'Uninstall'. Cancel |
124 // button remains same. | 129 // button remains same. |
125 if (button == ui::DIALOG_BUTTON_OK) | 130 if (button == ui::DIALOG_BUTTON_OK) |
126 return l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT); | 131 return l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT); |
127 return string16(); | 132 return string16(); |
128 } | 133 } |
129 | 134 |
130 void UninstallView::ButtonPressed(views::Button* sender, | 135 void UninstallView::ButtonPressed(views::Button* sender, |
131 const views::Event& event) { | 136 const views::Event& event) { |
132 if (change_default_browser_ == sender) { | 137 if (change_default_browser_ && change_default_browser_ == sender) { |
Peter Kasting
2012/06/08 18:37:48
Nit: Why is this necessary? You won't get called
motek.
2012/06/08 18:49:18
Wasn't sure of that. And since I am pathologically
| |
133 // Disable the browsers combobox if the user unchecks the checkbox. | 138 // Disable the browsers combobox if the user unchecks the checkbox. |
134 DCHECK(browsers_combo_); | 139 DCHECK(browsers_combo_); |
135 browsers_combo_->SetEnabled(change_default_browser_->checked()); | 140 browsers_combo_->SetEnabled(change_default_browser_->checked()); |
136 } | 141 } |
137 } | 142 } |
138 | 143 |
139 string16 UninstallView::GetWindowTitle() const { | 144 string16 UninstallView::GetWindowTitle() const { |
140 return l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME); | 145 return l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME); |
141 } | 146 } |
142 | 147 |
(...skipping 17 matching lines...) Expand all Loading... | |
160 | 165 |
161 int ShowUninstallBrowserPrompt() { | 166 int ShowUninstallBrowserPrompt() { |
162 int result = content::RESULT_CODE_NORMAL_EXIT; | 167 int result = content::RESULT_CODE_NORMAL_EXIT; |
163 views::Widget::CreateWindow(new UninstallView(&result))->Show(); | 168 views::Widget::CreateWindow(new UninstallView(&result))->Show(); |
164 views::AcceleratorHandler accelerator_handler; | 169 views::AcceleratorHandler accelerator_handler; |
165 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); | 170 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); |
166 return result; | 171 return result; |
167 } | 172 } |
168 | 173 |
169 } // namespace browser | 174 } // namespace browser |
OLD | NEW |