| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "chrome/browser/shell_integration.h" | 11 #include "chrome/browser/shell_integration.h" |
| 12 #include "chrome/common/chrome_result_codes.h" |
| 12 #include "chrome/installer/util/browser_distribution.h" | 13 #include "chrome/installer/util/browser_distribution.h" |
| 13 #include "chrome/installer/util/shell_util.h" | 14 #include "chrome/installer/util/shell_util.h" |
| 14 #include "content/common/result_codes.h" | |
| 15 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "views/controls/button/checkbox.h" | 17 #include "views/controls/button/checkbox.h" |
| 18 #include "views/controls/label.h" | 18 #include "views/controls/label.h" |
| 19 #include "views/layout/grid_layout.h" | 19 #include "views/layout/grid_layout.h" |
| 20 #include "views/layout/layout_constants.h" | 20 #include "views/layout/layout_constants.h" |
| 21 | 21 |
| 22 UninstallView::UninstallView(int& user_selection) | 22 UninstallView::UninstallView(int& user_selection) |
| 23 : confirm_label_(NULL), | 23 : confirm_label_(NULL), |
| 24 delete_profile_(NULL), | 24 delete_profile_(NULL), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 browsers_combo_ = new views::Combobox(this); | 90 browsers_combo_ = new views::Combobox(this); |
| 91 layout->AddView(browsers_combo_); | 91 layout->AddView(browsers_combo_); |
| 92 browsers_combo_->SetEnabled(false); | 92 browsers_combo_->SetEnabled(false); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 96 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool UninstallView::Accept() { | 99 bool UninstallView::Accept() { |
| 100 user_selection_ = ResultCodes::NORMAL_EXIT; | 100 user_selection_ = content::RESULT_CODE_NORMAL_EXIT; |
| 101 if (delete_profile_->checked()) | 101 if (delete_profile_->checked()) |
| 102 user_selection_ = ResultCodes::UNINSTALL_DELETE_PROFILE; | 102 user_selection_ = chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE; |
| 103 if (change_default_browser_ && change_default_browser_->checked()) { | 103 if (change_default_browser_ && change_default_browser_->checked()) { |
| 104 int index = browsers_combo_->selected_item(); | 104 int index = browsers_combo_->selected_item(); |
| 105 BrowsersMap::const_iterator it = browsers_->begin(); | 105 BrowsersMap::const_iterator it = browsers_->begin(); |
| 106 std::advance(it, index); | 106 std::advance(it, index); |
| 107 base::LaunchApp((*it).second, false, true, NULL); | 107 base::LaunchApp((*it).second, false, true, NULL); |
| 108 } | 108 } |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool UninstallView::Cancel() { | 112 bool UninstallView::Cancel() { |
| 113 user_selection_ = ResultCodes::UNINSTALL_USER_CANCEL; | 113 user_selection_ = chrome::RESULT_CODE_UNINSTALL_USER_CANCEL; |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 std::wstring UninstallView::GetDialogButtonLabel( | 117 std::wstring UninstallView::GetDialogButtonLabel( |
| 118 MessageBoxFlags::DialogButton button) const { | 118 MessageBoxFlags::DialogButton button) const { |
| 119 // We only want to give custom name to OK button - 'Uninstall'. Cancel | 119 // We only want to give custom name to OK button - 'Uninstall'. Cancel |
| 120 // button remains same. | 120 // button remains same. |
| 121 std::wstring label = L""; | 121 std::wstring label = L""; |
| 122 if (button == MessageBoxFlags::DIALOGBUTTON_OK) | 122 if (button == MessageBoxFlags::DIALOGBUTTON_OK) |
| 123 label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT)); | 123 label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 145 DCHECK(!browsers_->empty()); | 145 DCHECK(!browsers_->empty()); |
| 146 return browsers_->size(); | 146 return browsers_->size(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 string16 UninstallView::GetItemAt(int index) { | 149 string16 UninstallView::GetItemAt(int index) { |
| 150 DCHECK(index < (int) browsers_->size()); | 150 DCHECK(index < (int) browsers_->size()); |
| 151 BrowsersMap::const_iterator it = browsers_->begin(); | 151 BrowsersMap::const_iterator it = browsers_->begin(); |
| 152 std::advance(it, index); | 152 std::advance(it, index); |
| 153 return WideToUTF16Hack((*it).first); | 153 return WideToUTF16Hack((*it).first); |
| 154 } | 154 } |
| OLD | NEW |