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/first_run/try_chrome_dialog_view.h" | 5 #include "chrome/browser/first_run/try_chrome_dialog_view.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/process_singleton.h" | 12 #include "chrome/browser/process_singleton.h" |
13 #include "chrome/installer/util/browser_distribution.h" | 13 #include "chrome/installer/util/browser_distribution.h" |
14 #include "chrome/installer/util/user_experiment.h" | 14 #include "chrome/installer/util/user_experiment.h" |
15 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
18 #include "grit/ui_resources.h" | 18 #include "grit/ui_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
22 #include "ui/views/controls/button/checkbox.h" | 22 #include "ui/views/controls/button/checkbox.h" |
23 #include "ui/views/controls/button/image_button.h" | 23 #include "ui/views/controls/button/image_button.h" |
| 24 #include "ui/views/controls/button/label_button.h" |
24 #include "ui/views/controls/button/radio_button.h" | 25 #include "ui/views/controls/button/radio_button.h" |
25 #include "ui/views/controls/button/text_button.h" | |
26 #include "ui/views/controls/image_view.h" | 26 #include "ui/views/controls/image_view.h" |
27 #include "ui/views/controls/link.h" | 27 #include "ui/views/controls/link.h" |
28 #include "ui/views/controls/separator.h" | 28 #include "ui/views/controls/separator.h" |
29 #include "ui/views/layout/grid_layout.h" | 29 #include "ui/views/layout/grid_layout.h" |
30 #include "ui/views/layout/layout_constants.h" | 30 #include "ui/views/layout/layout_constants.h" |
31 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
32 | 32 |
33 #if defined(USE_AURA) | 33 #if defined(USE_AURA) |
34 #include "ui/aura/root_window.h" | 34 #include "ui/aura/root_window.h" |
35 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 dont_try_chrome_->set_listener(this); | 222 dont_try_chrome_->set_listener(this); |
223 layout->AddView(dont_try_chrome_); | 223 layout->AddView(dont_try_chrome_); |
224 } | 224 } |
225 if (experiment.flags & installer::kToastUiUninstall) { | 225 if (experiment.flags & installer::kToastUiUninstall) { |
226 layout->StartRow(0, 2); | 226 layout->StartRow(0, 2); |
227 kill_chrome_ = new views::RadioButton( | 227 kill_chrome_ = new views::RadioButton( |
228 l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME), kRadioGroupID); | 228 l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME), kRadioGroupID); |
229 layout->AddView(kill_chrome_); | 229 layout->AddView(kill_chrome_); |
230 } | 230 } |
231 | 231 |
232 views::Button* accept_button = new views::NativeTextButton( | 232 views::LabelButton* accept_button = new views::LabelButton( |
233 this, l10n_util::GetStringUTF16(IDS_OK)); | 233 this, l10n_util::GetStringUTF16(IDS_OK)); |
| 234 accept_button->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
234 accept_button->set_tag(BT_OK_BUTTON); | 235 accept_button->set_tag(BT_OK_BUTTON); |
235 | 236 |
236 views::Separator* separator = NULL; | 237 views::Separator* separator = NULL; |
237 if (experiment.flags & installer::kToastUiMakeDefault) { | 238 if (experiment.flags & installer::kToastUiMakeDefault) { |
238 // In this flavor we have some veritical space, then a separator line | 239 // In this flavor we have some veritical space, then a separator line |
239 // and the 'make default' checkbox and the OK button on the same row. | 240 // and the 'make default' checkbox and the OK button on the same row. |
240 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 241 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
241 layout->StartRow(0, 6); | 242 layout->StartRow(0, 6); |
242 separator = new views::Separator; | 243 separator = new views::Separator; |
243 layout->AddView(separator); | 244 layout->AddView(separator); |
244 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 245 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
245 | 246 |
246 layout->StartRow(0, 7); | 247 layout->StartRow(0, 7); |
247 make_default_ = new views::Checkbox( | 248 make_default_ = new views::Checkbox( |
248 l10n_util::GetStringUTF16(IDS_TRY_TOAST_SET_DEFAULT)); | 249 l10n_util::GetStringUTF16(IDS_TRY_TOAST_SET_DEFAULT)); |
249 make_default_->SetChecked(true); | 250 make_default_->SetChecked(true); |
250 layout->AddView(make_default_); | 251 layout->AddView(make_default_); |
251 layout->AddView(accept_button); | 252 layout->AddView(accept_button); |
252 } else { | 253 } else { |
253 // On this other flavor there is no checkbox, the OK button and possibly | 254 // On this other flavor there is no checkbox, the OK button and possibly |
254 // the cancel button are in the same row. | 255 // the cancel button are in the same row. |
255 layout->StartRowWithPadding(0, dont_bug_me_button ? 3 : 5, 0, 10); | 256 layout->StartRowWithPadding(0, dont_bug_me_button ? 3 : 5, 0, 10); |
256 layout->AddView(accept_button); | 257 layout->AddView(accept_button); |
257 if (dont_bug_me_button) { | 258 if (dont_bug_me_button) { |
258 // The dialog needs a "Don't bug me" as a button or as a radio button, | 259 // The dialog needs a "Don't bug me" as a button or as a radio button, |
259 // this the button case. | 260 // this the button case. |
260 views::Button* cancel_button = new views::NativeTextButton( | 261 views::LabelButton* cancel_button = new views::LabelButton( |
261 this, l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL)); | 262 this, l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL)); |
| 263 cancel_button->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
262 cancel_button->set_tag(BT_CLOSE_BUTTON); | 264 cancel_button->set_tag(BT_CLOSE_BUTTON); |
263 layout->AddView(cancel_button); | 265 layout->AddView(cancel_button); |
264 } | 266 } |
265 } | 267 } |
266 | 268 |
267 if (experiment.flags & installer::kToastUiWhyLink) { | 269 if (experiment.flags & installer::kToastUiWhyLink) { |
268 layout->StartRowWithPadding(0, 4, 0, 10); | 270 layout->StartRowWithPadding(0, 4, 0, 10); |
269 views::Link* link = new views::Link( | 271 views::Link* link = new views::Link( |
270 l10n_util::GetStringUTF16(IDS_TRY_TOAST_WHY)); | 272 l10n_util::GetStringUTF16(IDS_TRY_TOAST_WHY)); |
271 link->set_listener(this); | 273 link->set_listener(this); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 result_ = TRY_CHROME_AS_DEFAULT; | 374 result_ = TRY_CHROME_AS_DEFAULT; |
373 } | 375 } |
374 | 376 |
375 popup_->Close(); | 377 popup_->Close(); |
376 MessageLoop::current()->Quit(); | 378 MessageLoop::current()->Quit(); |
377 } | 379 } |
378 | 380 |
379 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { | 381 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { |
380 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); | 382 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); |
381 } | 383 } |
OLD | NEW |