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/first_run_bubble.h" | 5 #include "chrome/browser/views/first_run_bubble.h" |
6 | 6 |
7 #include "app/gfx/font_util.h" | 7 #include "app/gfx/font_util.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "app/win/hwnd_util.h" | 10 #include "app/win/hwnd_util.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 : bubble_window_(bubble_window), | 93 : bubble_window_(bubble_window), |
94 label1_(NULL), | 94 label1_(NULL), |
95 label2_(NULL), | 95 label2_(NULL), |
96 label3_(NULL), | 96 label3_(NULL), |
97 keep_button_(NULL), | 97 keep_button_(NULL), |
98 change_button_(NULL), | 98 change_button_(NULL), |
99 profile_(profile) { | 99 profile_(profile) { |
100 const gfx::Font& font = | 100 const gfx::Font& font = |
101 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); | 101 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); |
102 | 102 |
103 label1_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_TITLE)); | 103 label1_ = new views::Label( |
| 104 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_TITLE))); |
104 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); | 105 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); |
105 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 106 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
106 AddChildView(label1_); | 107 AddChildView(label1_); |
107 | 108 |
108 gfx::Size ps = GetPreferredSize(); | 109 gfx::Size ps = GetPreferredSize(); |
109 | 110 |
110 label2_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_SUBTEXT)); | 111 label2_ = new views::Label( |
| 112 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT))); |
111 label2_->SetMultiLine(true); | 113 label2_->SetMultiLine(true); |
112 label2_->SetFont(font); | 114 label2_->SetFont(font); |
113 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 115 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
114 label2_->SizeToFit(ps.width() - kBubblePadding * 2); | 116 label2_->SizeToFit(ps.width() - kBubblePadding * 2); |
115 AddChildView(label2_); | 117 AddChildView(label2_); |
116 | 118 |
117 std::wstring question_str = l10n_util::GetStringF(IDS_FR_BUBBLE_QUESTION, | 119 std::wstring question_str = UTF16ToWide(l10n_util::GetStringFUTF16( |
118 UTF16ToWideHack(GetDefaultSearchEngineName(profile))); | 120 IDS_FR_BUBBLE_QUESTION, |
| 121 GetDefaultSearchEngineName(profile))); |
119 label3_ = new views::Label(question_str); | 122 label3_ = new views::Label(question_str); |
120 label3_->SetMultiLine(true); | 123 label3_->SetMultiLine(true); |
121 label3_->SetFont(font); | 124 label3_->SetFont(font); |
122 label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 125 label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
123 label3_->SizeToFit(ps.width() - kBubblePadding * 2); | 126 label3_->SizeToFit(ps.width() - kBubblePadding * 2); |
124 AddChildView(label3_); | 127 AddChildView(label3_); |
125 | 128 |
126 std::wstring keep_str = l10n_util::GetStringF(IDS_FR_BUBBLE_OK, | 129 std::wstring keep_str = UTF16ToWide(l10n_util::GetStringFUTF16( |
127 UTF16ToWideHack(GetDefaultSearchEngineName(profile))); | 130 IDS_FR_BUBBLE_OK, |
| 131 GetDefaultSearchEngineName(profile))); |
128 keep_button_ = new views::NativeButton(this, keep_str); | 132 keep_button_ = new views::NativeButton(this, keep_str); |
129 keep_button_->SetIsDefault(true); | 133 keep_button_->SetIsDefault(true); |
130 AddChildView(keep_button_); | 134 AddChildView(keep_button_); |
131 | 135 |
132 std::wstring change_str = l10n_util::GetString(IDS_FR_BUBBLE_CHANGE); | 136 std::wstring change_str = |
| 137 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_CHANGE)); |
133 change_button_ = new views::NativeButton(this, change_str); | 138 change_button_ = new views::NativeButton(this, change_str); |
134 AddChildView(change_button_); | 139 AddChildView(change_button_); |
135 } | 140 } |
136 | 141 |
137 void FirstRunBubbleView::BubbleShown() { | 142 void FirstRunBubbleView::BubbleShown() { |
138 keep_button_->RequestFocus(); | 143 keep_button_->RequestFocus(); |
139 } | 144 } |
140 | 145 |
141 void FirstRunBubbleView::ButtonPressed(views::Button* sender, | 146 void FirstRunBubbleView::ButtonPressed(views::Button* sender, |
142 const views::Event& event) { | 147 const views::Event& event) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 Profile* profile) | 257 Profile* profile) |
253 : bubble_window_(bubble_window), | 258 : bubble_window_(bubble_window), |
254 label1_(NULL), | 259 label1_(NULL), |
255 label2_(NULL), | 260 label2_(NULL), |
256 label3_(NULL), | 261 label3_(NULL), |
257 close_button_(NULL), | 262 close_button_(NULL), |
258 profile_(profile) { | 263 profile_(profile) { |
259 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 264 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
260 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); | 265 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); |
261 | 266 |
262 label1_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_1)); | 267 label1_ = new views::Label( |
| 268 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_1))); |
263 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); | 269 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); |
264 label1_->SetColor(SK_ColorRED); | 270 label1_->SetColor(SK_ColorRED); |
265 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 271 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
266 AddChildView(label1_); | 272 AddChildView(label1_); |
267 | 273 |
268 label2_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_2)); | 274 label2_ = new views::Label( |
| 275 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_2))); |
269 label2_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); | 276 label2_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); |
270 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 277 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
271 AddChildView(label2_); | 278 AddChildView(label2_); |
272 | 279 |
273 gfx::Size ps = GetPreferredSize(); | 280 gfx::Size ps = GetPreferredSize(); |
274 | 281 |
275 label3_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_SUBTEXT)); | 282 label3_ = new views::Label( |
| 283 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_SUBTEXT))); |
276 label3_->SetMultiLine(true); | 284 label3_->SetMultiLine(true); |
277 label3_->SetFont(font); | 285 label3_->SetFont(font); |
278 label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 286 label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
279 label3_->SizeToFit(ps.width() - kOEMBubblePadding * 2); | 287 label3_->SizeToFit(ps.width() - kOEMBubblePadding * 2); |
280 AddChildView(label3_); | 288 AddChildView(label3_); |
281 | 289 |
282 close_button_ = new views::ImageButton(this); | 290 close_button_ = new views::ImageButton(this); |
283 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 291 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
284 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 292 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
285 close_button_->SetImage(views::CustomButton::BS_HOT, | 293 close_button_->SetImage(views::CustomButton::BS_HOT, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 FirstRunMinimalBubbleView::FirstRunMinimalBubbleView( | 403 FirstRunMinimalBubbleView::FirstRunMinimalBubbleView( |
396 FirstRunBubble* bubble_window, | 404 FirstRunBubble* bubble_window, |
397 Profile* profile) | 405 Profile* profile) |
398 : bubble_window_(bubble_window), | 406 : bubble_window_(bubble_window), |
399 profile_(profile), | 407 profile_(profile), |
400 label1_(NULL), | 408 label1_(NULL), |
401 label2_(NULL) { | 409 label2_(NULL) { |
402 const gfx::Font& font = | 410 const gfx::Font& font = |
403 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); | 411 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); |
404 | 412 |
405 label1_ = new views::Label(l10n_util::GetStringF(IDS_FR_SE_BUBBLE_TITLE, | 413 label1_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( |
406 UTF16ToWideHack(GetDefaultSearchEngineName(profile_)))); | 414 IDS_FR_SE_BUBBLE_TITLE, |
| 415 GetDefaultSearchEngineName(profile_)))); |
407 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); | 416 label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); |
408 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 417 label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
409 AddChildView(label1_); | 418 AddChildView(label1_); |
410 | 419 |
411 gfx::Size ps = GetPreferredSize(); | 420 gfx::Size ps = GetPreferredSize(); |
412 | 421 |
413 label2_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_SUBTEXT)); | 422 label2_ = new views::Label( |
| 423 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT))); |
414 label2_->SetMultiLine(true); | 424 label2_->SetMultiLine(true); |
415 label2_->SetFont(font); | 425 label2_->SetFont(font); |
416 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 426 label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
417 label2_->SizeToFit(ps.width() - kBubblePadding * 2); | 427 label2_->SizeToFit(ps.width() - kBubblePadding * 2); |
418 AddChildView(label2_); | 428 AddChildView(label2_); |
419 } | 429 } |
420 | 430 |
421 void FirstRunMinimalBubbleView::BubbleShown() { | 431 void FirstRunMinimalBubbleView::BubbleShown() { |
422 RequestFocus(); | 432 RequestFocus(); |
423 } | 433 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 if (::IsWindowEnabled(GetParent())) | 538 if (::IsWindowEnabled(GetParent())) |
529 InfoBubble::OnActivate(action, minimized, window); | 539 InfoBubble::OnActivate(action, minimized, window); |
530 } | 540 } |
531 | 541 |
532 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, | 542 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, |
533 bool closed_by_escape) { | 543 bool closed_by_escape) { |
534 // Make sure our parent window is re-enabled. | 544 // Make sure our parent window is re-enabled. |
535 if (!IsWindowEnabled(GetParent())) | 545 if (!IsWindowEnabled(GetParent())) |
536 ::EnableWindow(GetParent(), true); | 546 ::EnableWindow(GetParent(), true); |
537 } | 547 } |
OLD | NEW |