Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/views/first_run_customize_view.cc

Issue 113991: Make Combobox portable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/first_run_customize_view.h ('k') | chrome/browser/views/importer_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/first_run_customize_view.h" 5 #include "chrome/browser/views/first_run_customize_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/browser/importer/importer.h" 9 #include "chrome/browser/importer/importer.h"
10 #include "chrome/browser/first_run.h" 10 #include "chrome/browser/first_run.h"
11 #include "chrome/browser/metrics/user_metrics.h" 11 #include "chrome/browser/metrics/user_metrics.h"
12 #include "grit/chromium_strings.h" 12 #include "grit/chromium_strings.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "grit/locale_settings.h" 14 #include "grit/locale_settings.h"
15 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
16 #include "views/controls/button/checkbox.h" 16 #include "views/controls/button/checkbox.h"
17 #include "views/controls/combo_box.h"
18 #include "views/controls/image_view.h" 17 #include "views/controls/image_view.h"
19 #include "views/controls/label.h" 18 #include "views/controls/label.h"
20 #include "views/controls/throbber.h" 19 #include "views/controls/throbber.h"
21 #include "views/standard_layout.h" 20 #include "views/standard_layout.h"
22 #include "views/window/window.h" 21 #include "views/window/window.h"
23 22
24 FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile, 23 FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile,
25 ImporterHost* importer_host, 24 ImporterHost* importer_host,
26 CustomizeViewObserver* observer, 25 CustomizeViewObserver* observer,
27 bool default_browser_checked) 26 bool default_browser_checked)
(...skipping 30 matching lines...) Expand all
58 using views::Label; 57 using views::Label;
59 using views::Checkbox; 58 using views::Checkbox;
60 59
61 main_label_ = new Label(l10n_util::GetString(IDS_FR_CUSTOMIZE_DLG_TEXT)); 60 main_label_ = new Label(l10n_util::GetString(IDS_FR_CUSTOMIZE_DLG_TEXT));
62 main_label_->SetMultiLine(true); 61 main_label_->SetMultiLine(true);
63 main_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 62 main_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
64 AddChildView(main_label_); 63 AddChildView(main_label_);
65 64
66 import_cbox_ = MakeCheckBox(IDS_FR_CUSTOMIZE_IMPORT); 65 import_cbox_ = MakeCheckBox(IDS_FR_CUSTOMIZE_IMPORT);
67 66
68 import_from_combo_ = new views::ComboBox(this); 67 import_from_combo_ = new views::Combobox(this);
69 AddChildView(import_from_combo_); 68 AddChildView(import_from_combo_);
70 69
71 shortcuts_label_ = 70 shortcuts_label_ =
72 new Label(l10n_util::GetString(IDS_FR_CUSTOMIZE_SHORTCUTS)); 71 new Label(l10n_util::GetString(IDS_FR_CUSTOMIZE_SHORTCUTS));
73 shortcuts_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 72 shortcuts_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
74 AddChildView(shortcuts_label_); 73 AddChildView(shortcuts_label_);
75 74
76 // The two check boxes for the different shortcut creation. 75 // The two check boxes for the different shortcut creation.
77 desktop_shortcut_cbox_ = MakeCheckBox(IDS_FR_CUSTOM_SHORTCUT_DESKTOP); 76 desktop_shortcut_cbox_ = MakeCheckBox(IDS_FR_CUSTOM_SHORTCUT_DESKTOP);
78 desktop_shortcut_cbox_->SetChecked(true); 77 desktop_shortcut_cbox_->SetChecked(true);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 AdjustDialogWidth(quick_shortcut_cbox_); 152 AdjustDialogWidth(quick_shortcut_cbox_);
154 } 153 }
155 154
156 void FirstRunCustomizeView::ButtonPressed(views::Button* sender) { 155 void FirstRunCustomizeView::ButtonPressed(views::Button* sender) {
157 if (import_cbox_ == sender) { 156 if (import_cbox_ == sender) {
158 // Disable the import combobox if the user unchecks the checkbox. 157 // Disable the import combobox if the user unchecks the checkbox.
159 import_from_combo_->SetEnabled(import_cbox_->checked()); 158 import_from_combo_->SetEnabled(import_cbox_->checked());
160 } 159 }
161 } 160 }
162 161
163 int FirstRunCustomizeView::GetItemCount(views::ComboBox* source) { 162 int FirstRunCustomizeView::GetItemCount(views::Combobox* source) {
164 return importer_host_->GetAvailableProfileCount(); 163 return importer_host_->GetAvailableProfileCount();
165 } 164 }
166 165
167 std::wstring FirstRunCustomizeView::GetItemAt(views::ComboBox* source, 166 std::wstring FirstRunCustomizeView::GetItemAt(views::Combobox* source,
168 int index) { 167 int index) {
169 return importer_host_->GetSourceProfileNameAt(index); 168 return importer_host_->GetSourceProfileNameAt(index);
170 } 169 }
171 170
172 std::wstring FirstRunCustomizeView::GetWindowTitle() const { 171 std::wstring FirstRunCustomizeView::GetWindowTitle() const {
173 return l10n_util::GetString(IDS_FR_CUSTOMIZE_DLG_TITLE); 172 return l10n_util::GetString(IDS_FR_CUSTOMIZE_DLG_TITLE);
174 } 173 }
175 174
176 views::View* FirstRunCustomizeView::GetContentsView() { 175 views::View* FirstRunCustomizeView::GetContentsView() {
177 return this; 176 return this;
(...skipping 13 matching lines...) Expand all
191 UserMetrics::RecordAction(L"FirstRunCustom_Do_DesktopShortcut", profile_); 190 UserMetrics::RecordAction(L"FirstRunCustom_Do_DesktopShortcut", profile_);
192 CreateDesktopShortcut(); 191 CreateDesktopShortcut();
193 } 192 }
194 if (quick_shortcut_cbox_->checked()) { 193 if (quick_shortcut_cbox_->checked()) {
195 UserMetrics::RecordAction(L"FirstRunCustom_Do_QuickLShortcut", profile_); 194 UserMetrics::RecordAction(L"FirstRunCustom_Do_QuickLShortcut", profile_);
196 CreateQuickLaunchShortcut(); 195 CreateQuickLaunchShortcut();
197 } 196 }
198 if (!import_cbox_->checked()) { 197 if (!import_cbox_->checked()) {
199 UserMetrics::RecordAction(L"FirstRunCustom_No_Import", profile_); 198 UserMetrics::RecordAction(L"FirstRunCustom_No_Import", profile_);
200 } else { 199 } else {
201 int browser_selected = import_from_combo_->GetSelectedItem(); 200 int browser_selected = import_from_combo_->selected_item();
202 FirstRun::ImportSettings(profile_, 201 FirstRun::ImportSettings(profile_,
203 importer_host_->GetSourceProfileInfoAt(browser_selected).browser_type, 202 importer_host_->GetSourceProfileInfoAt(browser_selected).browser_type,
204 GetDefaultImportItems(), window()->GetNativeWindow()); 203 GetDefaultImportItems(), window()->GetNativeWindow());
205 } 204 }
206 if (default_browser_->checked()) 205 if (default_browser_->checked())
207 SetDefaultBrowser(); 206 SetDefaultBrowser();
208 207
209 if (customize_observer_) 208 if (customize_observer_)
210 customize_observer_->CustomizeAccepted(); 209 customize_observer_->CustomizeAccepted();
211 210
212 // Exit the message loop we were started with so that startup can continue. 211 // Exit the message loop we were started with so that startup can continue.
213 MessageLoop::current()->Quit(); 212 MessageLoop::current()->Quit();
214 213
215 return true; 214 return true;
216 } 215 }
217 216
218 bool FirstRunCustomizeView::Cancel() { 217 bool FirstRunCustomizeView::Cancel() {
219 if (customize_observer_) 218 if (customize_observer_)
220 customize_observer_->CustomizeCanceled(); 219 customize_observer_->CustomizeCanceled();
221 220
222 // Don't quit the message loop in this case - we're still showing the main 221 // Don't quit the message loop in this case - we're still showing the main
223 // First run dialog box underneath ourselves. 222 // First run dialog box underneath ourselves.
224 223
225 return true; 224 return true;
226 } 225 }
OLDNEW
« no previous file with comments | « chrome/browser/views/first_run_customize_view.h ('k') | chrome/browser/views/importer_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698