| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/default_search_view.h" | 5 #include "chrome/browser/ui/views/default_search_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 *short_name = built_in_data->short_name(); | 52 *short_name = built_in_data->short_name(); |
| 53 *logo_id = built_in_data->logo_id(); | 53 *logo_id = built_in_data->logo_id(); |
| 54 } else { | 54 } else { |
| 55 *short_name = UTF8ToWide(url.host()).c_str(); | 55 *short_name = UTF8ToWide(url.host()).c_str(); |
| 56 *logo_id = kNoSearchEngineLogo; | 56 *logo_id = kNoSearchEngineLogo; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 views::Label* CreateProviderLabel(int message_id) { | 60 views::Label* CreateProviderLabel(int message_id) { |
| 61 views::Label* choice_label = | 61 views::Label* choice_label = |
| 62 new views::Label(l10n_util::GetStringUTF16(message_id)); | 62 new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id))); |
| 63 choice_label->SetColor(SK_ColorBLACK); | 63 choice_label->SetColor(SK_ColorBLACK); |
| 64 choice_label->SetFont( | 64 choice_label->SetFont( |
| 65 choice_label->font().DeriveFont(1, gfx::Font::NORMAL)); | 65 choice_label->font().DeriveFont(1, gfx::Font::NORMAL)); |
| 66 return choice_label; | 66 return choice_label; |
| 67 } | 67 } |
| 68 | 68 |
| 69 views::View* CreateProviderLogo( | 69 views::View* CreateProviderLogo( |
| 70 int logo_id, | 70 int logo_id, |
| 71 const std::wstring& short_name) { | 71 const std::wstring& short_name) { |
| 72 views::View* logo_view = NULL; | 72 views::View* logo_view = NULL; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 background_image_->SetImage(rb.GetBitmapNamed(IDR_SEARCH_ENGINE_DIALOG_TOP)); | 272 background_image_->SetImage(rb.GetBitmapNamed(IDR_SEARCH_ENGINE_DIALOG_TOP)); |
| 273 background_image_->EnableCanvasFlippingForRTLUI(true); | 273 background_image_->EnableCanvasFlippingForRTLUI(true); |
| 274 ImageView::Alignment horizontal_alignment = | 274 ImageView::Alignment horizontal_alignment = |
| 275 base::i18n::IsRTL() ? ImageView::LEADING : ImageView::TRAILING; | 275 base::i18n::IsRTL() ? ImageView::LEADING : ImageView::TRAILING; |
| 276 background_image_->SetHorizontalAlignment(horizontal_alignment); | 276 background_image_->SetHorizontalAlignment(horizontal_alignment); |
| 277 layout->AddView(background_image_); | 277 layout->AddView(background_image_); |
| 278 | 278 |
| 279 // Add text informing the user about the requested default change. | 279 // Add text informing the user about the requested default change. |
| 280 layout->StartRowWithPadding(0, kPaddedWholeDialogViewSetId, | 280 layout->StartRowWithPadding(0, kPaddedWholeDialogViewSetId, |
| 281 1, views::kLabelToControlVerticalSpacing); | 281 1, views::kLabelToControlVerticalSpacing); |
| 282 Label* summary_label = new Label(l10n_util::GetStringFUTF16( | 282 Label* summary_label = new Label(UTF16ToWide(l10n_util::GetStringFUTF16( |
| 283 IDS_DEFAULT_SEARCH_SUMMARY, | 283 IDS_DEFAULT_SEARCH_SUMMARY, |
| 284 WideToUTF16(proposed_short_name))); | 284 WideToUTF16(proposed_short_name)))); |
| 285 summary_label->SetColor(SK_ColorBLACK); | 285 summary_label->SetColor(SK_ColorBLACK); |
| 286 summary_label->SetFont( | 286 summary_label->SetFont( |
| 287 summary_label->font().DeriveFont(1, gfx::Font::NORMAL)); | 287 summary_label->font().DeriveFont(1, gfx::Font::NORMAL)); |
| 288 summary_label->SetHorizontalAlignment(Label::ALIGN_LEFT); | 288 summary_label->SetHorizontalAlignment(Label::ALIGN_LEFT); |
| 289 layout->AddView(summary_label); | 289 layout->AddView(summary_label); |
| 290 | 290 |
| 291 // Add the labels for the tops of the choices. | 291 // Add the labels for the tops of the choices. |
| 292 layout->StartRowWithPadding(0, kChoicesViewSetId, | 292 layout->StartRowWithPadding(0, kChoicesViewSetId, |
| 293 0, views::kRelatedControlVerticalSpacing); | 293 0, views::kRelatedControlVerticalSpacing); |
| 294 layout->AddView(CreateProviderLabel(IDS_DEFAULT_SEARCH_LABEL_CURRENT)); | 294 layout->AddView(CreateProviderLabel(IDS_DEFAULT_SEARCH_LABEL_CURRENT)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 307 this, | 307 this, |
| 308 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, | 308 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, |
| 309 default_short_name); | 309 default_short_name); |
| 310 layout->AddView(default_provider_button_); | 310 layout->AddView(default_provider_button_); |
| 311 proposed_provider_button_ = CreateProviderChoiceButton( | 311 proposed_provider_button_ = CreateProviderChoiceButton( |
| 312 this, | 312 this, |
| 313 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, | 313 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, |
| 314 proposed_short_name); | 314 proposed_short_name); |
| 315 layout->AddView(proposed_provider_button_); | 315 layout->AddView(proposed_provider_button_); |
| 316 } | 316 } |
| OLD | NEW |