OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/uninstall_view.h" | 5 #include "chrome/browser/views/uninstall_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 GridLayout* layout = CreatePanelGridLayout(this); | 41 GridLayout* layout = CreatePanelGridLayout(this); |
42 SetLayoutManager(layout); | 42 SetLayoutManager(layout); |
43 | 43 |
44 // Message to confirm uninstallation. | 44 // Message to confirm uninstallation. |
45 int column_set_id = 0; | 45 int column_set_id = 0; |
46 ColumnSet* column_set = layout->AddColumnSet(column_set_id); | 46 ColumnSet* column_set = layout->AddColumnSet(column_set_id); |
47 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 47 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
48 GridLayout::USE_PREF, 0, 0); | 48 GridLayout::USE_PREF, 0, 0); |
49 layout->StartRow(0, column_set_id); | 49 layout->StartRow(0, column_set_id); |
50 confirm_label_ = new views::Label(l10n_util::GetString(IDS_UNINSTALL_VERIFY)); | 50 confirm_label_ = new views::Label(UTF16ToWide( |
| 51 l10n_util::GetStringUTF16(IDS_UNINSTALL_VERIFY))); |
51 confirm_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 52 confirm_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
52 layout->AddView(confirm_label_); | 53 layout->AddView(confirm_label_); |
53 | 54 |
54 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); | 55 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); |
55 | 56 |
56 // The "delete profile" check box. | 57 // The "delete profile" check box. |
57 ++column_set_id; | 58 ++column_set_id; |
58 column_set = layout->AddColumnSet(column_set_id); | 59 column_set = layout->AddColumnSet(column_set_id); |
59 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 60 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
60 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 61 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
61 GridLayout::USE_PREF, 0, 0); | 62 GridLayout::USE_PREF, 0, 0); |
62 layout->StartRow(0, column_set_id); | 63 layout->StartRow(0, column_set_id); |
63 delete_profile_ = new views::Checkbox( | 64 delete_profile_ = new views::Checkbox( |
64 l10n_util::GetString(IDS_UNINSTALL_DELETE_PROFILE)); | 65 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE))); |
65 layout->AddView(delete_profile_); | 66 layout->AddView(delete_profile_); |
66 | 67 |
67 // Set default browser combo box | 68 // Set default browser combo box |
68 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 69 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
69 if (dist->CanSetAsDefault() && | 70 if (dist->CanSetAsDefault() && |
70 ShellIntegration::IsDefaultBrowser()) { | 71 ShellIntegration::IsDefaultBrowser()) { |
71 browsers_.reset(new BrowsersMap()); | 72 browsers_.reset(new BrowsersMap()); |
72 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); | 73 ShellUtil::GetRegisteredBrowsers(dist, browsers_.get()); |
73 if (!browsers_->empty()) { | 74 if (!browsers_->empty()) { |
74 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 75 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
75 | 76 |
76 ++column_set_id; | 77 ++column_set_id; |
77 column_set = layout->AddColumnSet(column_set_id); | 78 column_set = layout->AddColumnSet(column_set_id); |
78 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 79 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
79 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 80 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
80 GridLayout::USE_PREF, 0, 0); | 81 GridLayout::USE_PREF, 0, 0); |
81 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 82 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
82 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 83 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
83 GridLayout::USE_PREF, 0, 0); | 84 GridLayout::USE_PREF, 0, 0); |
84 layout->StartRow(0, column_set_id); | 85 layout->StartRow(0, column_set_id); |
85 change_default_browser_ = new views::Checkbox( | 86 change_default_browser_ = new views::Checkbox(UTF16ToWide( |
86 l10n_util::GetString(IDS_UNINSTALL_SET_DEFAULT_BROWSER)); | 87 l10n_util::GetStringUTF16(IDS_UNINSTALL_SET_DEFAULT_BROWSER))); |
87 change_default_browser_->set_listener(this); | 88 change_default_browser_->set_listener(this); |
88 layout->AddView(change_default_browser_); | 89 layout->AddView(change_default_browser_); |
89 browsers_combo_ = new views::Combobox(this); | 90 browsers_combo_ = new views::Combobox(this); |
90 layout->AddView(browsers_combo_); | 91 layout->AddView(browsers_combo_); |
91 browsers_combo_->SetEnabled(false); | 92 browsers_combo_->SetEnabled(false); |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); | 96 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); |
96 } | 97 } |
(...skipping 15 matching lines...) Expand all Loading... |
112 user_selection_ = ResultCodes::UNINSTALL_USER_CANCEL; | 113 user_selection_ = ResultCodes::UNINSTALL_USER_CANCEL; |
113 return true; | 114 return true; |
114 } | 115 } |
115 | 116 |
116 std::wstring UninstallView::GetDialogButtonLabel( | 117 std::wstring UninstallView::GetDialogButtonLabel( |
117 MessageBoxFlags::DialogButton button) const { | 118 MessageBoxFlags::DialogButton button) const { |
118 // 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 |
119 // button remains same. | 120 // button remains same. |
120 std::wstring label = L""; | 121 std::wstring label = L""; |
121 if (button == MessageBoxFlags::DIALOGBUTTON_OK) | 122 if (button == MessageBoxFlags::DIALOGBUTTON_OK) |
122 label = l10n_util::GetString(IDS_UNINSTALL_BUTTON_TEXT); | 123 label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT)); |
123 return label; | 124 return label; |
124 } | 125 } |
125 | 126 |
126 void UninstallView::ButtonPressed( | 127 void UninstallView::ButtonPressed( |
127 views::Button* sender, const views::Event& event) { | 128 views::Button* sender, const views::Event& event) { |
128 if (change_default_browser_ == sender) { | 129 if (change_default_browser_ == sender) { |
129 // Disable the browsers combobox if the user unchecks the checkbox. | 130 // Disable the browsers combobox if the user unchecks the checkbox. |
130 DCHECK(browsers_combo_); | 131 DCHECK(browsers_combo_); |
131 browsers_combo_->SetEnabled(change_default_browser_->checked()); | 132 browsers_combo_->SetEnabled(change_default_browser_->checked()); |
132 } | 133 } |
133 } | 134 } |
134 | 135 |
135 std::wstring UninstallView::GetWindowTitle() const { | 136 std::wstring UninstallView::GetWindowTitle() const { |
136 return l10n_util::GetString(IDS_UNINSTALL_CHROME); | 137 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME)); |
137 } | 138 } |
138 | 139 |
139 views::View* UninstallView::GetContentsView() { | 140 views::View* UninstallView::GetContentsView() { |
140 return this; | 141 return this; |
141 } | 142 } |
142 | 143 |
143 int UninstallView::GetItemCount() { | 144 int UninstallView::GetItemCount() { |
144 DCHECK(!browsers_->empty()); | 145 DCHECK(!browsers_->empty()); |
145 return browsers_->size(); | 146 return browsers_->size(); |
146 } | 147 } |
147 | 148 |
148 string16 UninstallView::GetItemAt(int index) { | 149 string16 UninstallView::GetItemAt(int index) { |
149 DCHECK(index < (int) browsers_->size()); | 150 DCHECK(index < (int) browsers_->size()); |
150 BrowsersMap::const_iterator it = browsers_->begin(); | 151 BrowsersMap::const_iterator it = browsers_->begin(); |
151 std::advance(it, index); | 152 std::advance(it, index); |
152 return WideToUTF16Hack((*it).first); | 153 return WideToUTF16Hack((*it).first); |
153 } | 154 } |
OLD | NEW |