| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 TryChromeDialogView::~TryChromeDialogView() { | 59 TryChromeDialogView::~TryChromeDialogView() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 TryChromeDialogView::Result TryChromeDialogView::ShowModal( | 62 TryChromeDialogView::Result TryChromeDialogView::ShowModal( |
| 63 ProcessSingleton* process_singleton) { | 63 ProcessSingleton* process_singleton) { |
| 64 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 64 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 65 | 65 |
| 66 views::ImageView* icon = new views::ImageView(); | 66 views::ImageView* icon = new views::ImageView(); |
| 67 icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToSkBitmap()); | 67 icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia()); |
| 68 gfx::Size icon_size = icon->GetPreferredSize(); | 68 gfx::Size icon_size = icon->GetPreferredSize(); |
| 69 | 69 |
| 70 // An approximate window size. After Layout() we'll get better bounds. | 70 // An approximate window size. After Layout() we'll get better bounds. |
| 71 popup_ = new views::Widget; | 71 popup_ = new views::Widget; |
| 72 if (!popup_) { | 72 if (!popup_) { |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 return DIALOG_ERROR; | 74 return DIALOG_ERROR; |
| 75 } | 75 } |
| 76 | 76 |
| 77 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 77 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 string16 heading = l10n_util::GetStringUTF16(experiment.heading); | 152 string16 heading = l10n_util::GetStringUTF16(experiment.heading); |
| 153 views::Label* label = new views::Label(heading); | 153 views::Label* label = new views::Label(heading); |
| 154 label->SetFont(rb.GetFont(ResourceBundle::MediumBoldFont)); | 154 label->SetFont(rb.GetFont(ResourceBundle::MediumBoldFont)); |
| 155 label->SetMultiLine(true); | 155 label->SetMultiLine(true); |
| 156 label->SizeToFit(200); | 156 label->SizeToFit(200); |
| 157 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 157 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 158 layout->AddView(label); | 158 layout->AddView(label); |
| 159 // The close button is custom. | 159 // The close button is custom. |
| 160 views::ImageButton* close_button = new views::ImageButton(this); | 160 views::ImageButton* close_button = new views::ImageButton(this); |
| 161 close_button->SetImage(views::CustomButton::BS_NORMAL, | 161 close_button->SetImage(views::CustomButton::BS_NORMAL, |
| 162 rb.GetNativeImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); | 162 rb.GetNativeImageNamed(IDR_CLOSE_BAR).ToImageSkia()); |
| 163 close_button->SetImage(views::CustomButton::BS_HOT, | 163 close_button->SetImage(views::CustomButton::BS_HOT, |
| 164 rb.GetNativeImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); | 164 rb.GetNativeImageNamed(IDR_CLOSE_BAR_H).ToImageSkia()); |
| 165 close_button->SetImage(views::CustomButton::BS_PUSHED, | 165 close_button->SetImage(views::CustomButton::BS_PUSHED, |
| 166 rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); | 166 rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); |
| 167 close_button->set_tag(BT_CLOSE_BUTTON); | 167 close_button->set_tag(BT_CLOSE_BUTTON); |
| 168 layout->AddView(close_button); | 168 layout->AddView(close_button); |
| 169 | 169 |
| 170 // Second row views. | 170 // Second row views. |
| 171 const string16 try_it(l10n_util::GetStringUTF16(IDS_TRY_TOAST_TRY_OPT)); | 171 const string16 try_it(l10n_util::GetStringUTF16(IDS_TRY_TOAST_TRY_OPT)); |
| 172 layout->StartRowWithPadding(0, 1, 0, 10); | 172 layout->StartRowWithPadding(0, 1, 0, 10); |
| 173 try_chrome_ = new views::RadioButton(try_it, 1); | 173 try_chrome_ = new views::RadioButton(try_it, 1); |
| 174 layout->AddView(try_chrome_); | 174 layout->AddView(try_chrome_); |
| 175 try_chrome_->SetChecked(true); | 175 try_chrome_->SetChecked(true); |
| 176 | 176 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 else | 286 else |
| 287 NOTREACHED() << "Unknown radio button selected"; | 287 NOTREACHED() << "Unknown radio button selected"; |
| 288 } | 288 } |
| 289 popup_->Close(); | 289 popup_->Close(); |
| 290 MessageLoop::current()->Quit(); | 290 MessageLoop::current()->Quit(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { | 293 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { |
| 294 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); | 294 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); |
| 295 } | 295 } |
| OLD | NEW |