OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/options/general_page_view.h" | 5 #include "chrome/browser/views/options/general_page_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 "base/gfx/png_decoder.h" | 9 #include "base/gfx/png_decoder.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/views/keyword_editor_view.h" | 24 #include "chrome/browser/views/keyword_editor_view.h" |
25 #include "chrome/browser/views/options/options_group_view.h" | 25 #include "chrome/browser/views/options/options_group_view.h" |
26 #include "chrome/browser/dom_ui/new_tab_ui.h" | 26 #include "chrome/browser/dom_ui/new_tab_ui.h" |
27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/pref_service.h" | 29 #include "chrome/common/pref_service.h" |
30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
31 #include "grit/app_resources.h" | 31 #include "grit/app_resources.h" |
32 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
33 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 34 #include "net/base/net_util.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
35 #include "views/controls/button/radio_button.h" | 36 #include "views/controls/button/radio_button.h" |
36 #include "views/controls/label.h" | 37 #include "views/controls/label.h" |
37 #include "views/controls/table/table_view.h" | 38 #include "views/controls/table/table_view.h" |
38 #include "views/controls/text_field.h" | 39 #include "views/controls/text_field.h" |
39 #include "views/grid_layout.h" | 40 #include "views/grid_layout.h" |
40 #include "views/standard_layout.h" | 41 #include "views/standard_layout.h" |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return urls; | 295 return urls; |
295 } | 296 } |
296 | 297 |
297 int CustomHomePagesTableModel::RowCount() { | 298 int CustomHomePagesTableModel::RowCount() { |
298 return static_cast<int>(entries_.size()); | 299 return static_cast<int>(entries_.size()); |
299 } | 300 } |
300 | 301 |
301 std::wstring CustomHomePagesTableModel::GetText(int row, int column_id) { | 302 std::wstring CustomHomePagesTableModel::GetText(int row, int column_id) { |
302 DCHECK(column_id == 0); | 303 DCHECK(column_id == 0); |
303 DCHECK(row >= 0 && row < RowCount()); | 304 DCHECK(row >= 0 && row < RowCount()); |
| 305 std::wstring languages = |
| 306 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
304 // No need to force URL to have LTR directionality because the custom home | 307 // No need to force URL to have LTR directionality because the custom home |
305 // pages control is created using LTR directionality. | 308 // pages control is created using LTR directionality. |
306 return UTF8ToWide(entries_[row].url.spec()); | 309 return net::FormatUrl(entries_[row].url, languages); |
307 } | 310 } |
308 | 311 |
309 SkBitmap CustomHomePagesTableModel::GetIcon(int row) { | 312 SkBitmap CustomHomePagesTableModel::GetIcon(int row) { |
310 DCHECK(row >= 0 && row < RowCount()); | 313 DCHECK(row >= 0 && row < RowCount()); |
311 if (!entries_[row].icon.isNull()) | 314 if (!entries_[row].icon.isNull()) |
312 return entries_[row].icon; | 315 return entries_[row].icon; |
313 return default_favicon_; | 316 return default_favicon_; |
314 } | 317 } |
315 | 318 |
316 void CustomHomePagesTableModel::SetObserver( | 319 void CustomHomePagesTableModel::SetObserver( |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 homepage_use_url_textfield_->SetEnabled(false); | 1084 homepage_use_url_textfield_->SetEnabled(false); |
1082 homepage_use_url_textfield_->SetReadOnly(true); | 1085 homepage_use_url_textfield_->SetReadOnly(true); |
1083 } | 1086 } |
1084 } | 1087 } |
1085 | 1088 |
1086 void GeneralPageView::SetDefaultSearchProvider() { | 1089 void GeneralPageView::SetDefaultSearchProvider() { |
1087 const int index = default_search_engine_combobox_->GetSelectedItem(); | 1090 const int index = default_search_engine_combobox_->GetSelectedItem(); |
1088 default_search_engines_model_->model()->SetDefaultSearchProvider( | 1091 default_search_engines_model_->model()->SetDefaultSearchProvider( |
1089 default_search_engines_model_->GetTemplateURLAt(index)); | 1092 default_search_engines_model_->GetTemplateURLAt(index)); |
1090 } | 1093 } |
OLD | NEW |