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/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. We assume here that if Chrome cannot |
| 73 // be set automatically as default, neither can any other browser (for | |
|
gab
2012/06/07 19:13:28
automatically --> programmatically
motek.
2012/06/08 15:03:32
Done.
| |
| 74 // instance because the distribution or the OS doesn't permit that. | |
|
gab
2012/06/07 19:13:28
"." => ")."
gab
2012/06/07 19:13:28
-distribution (i.e. our distribution is not the bl
motek.
2012/06/08 15:03:32
Done.
motek.
2012/06/08 15:03:32
Done + clarified a bit (because we indeed don't sh
| |
| 73 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 75 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 74 if (dist->CanSetAsDefault() && | 76 if (dist->CanSetAsDefault() && |
| 75 ShellIntegration::IsDefaultBrowser()) { | 77 ShellIntegration::IsDefaultBrowser() && |
| 78 ShellIntegration::CanSetAsDefaultBrowser() != | |
| 79 ShellIntegration::SET_DEFAULT_INTERACTIVE) { | |
| 76 browsers_.reset(new BrowsersMap()); | 80 browsers_.reset(new BrowsersMap()); |
| 77 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); | 81 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); |
| 78 if (!browsers_->empty()) { | 82 if (!browsers_->empty()) { |
| 79 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 83 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 80 | 84 |
| 81 ++column_set_id; | 85 ++column_set_id; |
| 82 column_set = layout->AddColumnSet(column_set_id); | 86 column_set = layout->AddColumnSet(column_set_id); |
| 83 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 87 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); |
| 84 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 88 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 85 GridLayout::USE_PREF, 0, 0); | 89 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 { | 126 string16 UninstallView::GetDialogButtonLabel(ui::DialogButton button) const { |
| 123 // We only want to give custom name to OK button - 'Uninstall'. Cancel | 127 // We only want to give custom name to OK button - 'Uninstall'. Cancel |
| 124 // button remains same. | 128 // button remains same. |
| 125 if (button == ui::DIALOG_BUTTON_OK) | 129 if (button == ui::DIALOG_BUTTON_OK) |
| 126 return l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT); | 130 return l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT); |
| 127 return string16(); | 131 return string16(); |
| 128 } | 132 } |
| 129 | 133 |
| 130 void UninstallView::ButtonPressed(views::Button* sender, | 134 void UninstallView::ButtonPressed(views::Button* sender, |
| 131 const views::Event& event) { | 135 const views::Event& event) { |
| 132 if (change_default_browser_ == sender) { | 136 if (change_default_browser_ && change_default_browser_ == sender) { |
| 133 // Disable the browsers combobox if the user unchecks the checkbox. | 137 // Disable the browsers combobox if the user unchecks the checkbox. |
| 134 DCHECK(browsers_combo_); | 138 DCHECK(browsers_combo_); |
| 135 browsers_combo_->SetEnabled(change_default_browser_->checked()); | 139 browsers_combo_->SetEnabled(change_default_browser_->checked()); |
| 136 } | 140 } |
| 137 } | 141 } |
| 138 | 142 |
| 139 string16 UninstallView::GetWindowTitle() const { | 143 string16 UninstallView::GetWindowTitle() const { |
| 140 return l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME); | 144 return l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME); |
| 141 } | 145 } |
| 142 | 146 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 160 | 164 |
| 161 int ShowUninstallBrowserPrompt() { | 165 int ShowUninstallBrowserPrompt() { |
| 162 int result = content::RESULT_CODE_NORMAL_EXIT; | 166 int result = content::RESULT_CODE_NORMAL_EXIT; |
| 163 views::Widget::CreateWindow(new UninstallView(&result))->Show(); | 167 views::Widget::CreateWindow(new UninstallView(&result))->Show(); |
| 164 views::AcceleratorHandler accelerator_handler; | 168 views::AcceleratorHandler accelerator_handler; |
| 165 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); | 169 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); |
| 166 return result; | 170 return result; |
| 167 } | 171 } |
| 168 | 172 |
| 169 } // namespace browser | 173 } // namespace browser |
| OLD | NEW |