| 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/possible_url_model.h" | 5 #include "chrome/browser/possible_url_model.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // since those should always have LTR directionality. Please refer to | 113 // since those should always have LTR directionality. Please refer to |
| 114 // http://crbug.com/6726 for more information. | 114 // http://crbug.com/6726 for more information. |
| 115 std::wstring localized_title; | 115 std::wstring localized_title; |
| 116 if (base::i18n::AdjustStringForLocaleDirection(title, &localized_title)) | 116 if (base::i18n::AdjustStringForLocaleDirection(title, &localized_title)) |
| 117 return localized_title; | 117 return localized_title; |
| 118 return title; | 118 return title; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // TODO(brettw): this should probably pass the GURL up so the URL elider | 121 // TODO(brettw): this should probably pass the GURL up so the URL elider |
| 122 // can be used at a higher level when we know the width. | 122 // can be used at a higher level when we know the width. |
| 123 // Force URL to be LTR. | 123 string16 url = results_[row].display_url.display_url(); |
| 124 std::wstring url(UTF16ToWideHack(results_[row].display_url.display_url())); | 124 return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(url)); |
| 125 base::i18n::GetDisplayStringInLTRDirectionality(&url); | |
| 126 return url; | |
| 127 } | 125 } |
| 128 | 126 |
| 129 SkBitmap PossibleURLModel::GetIcon(int row) { | 127 SkBitmap PossibleURLModel::GetIcon(int row) { |
| 130 if (row < 0 || row >= RowCount()) { | 128 if (row < 0 || row >= RowCount()) { |
| 131 NOTREACHED(); | 129 NOTREACHED(); |
| 132 return *default_fav_icon; | 130 return *default_fav_icon; |
| 133 } | 131 } |
| 134 | 132 |
| 135 Result& result = results_[row]; | 133 Result& result = results_[row]; |
| 136 FavIconMap::iterator i = fav_icon_map_.find(result.index); | 134 FavIconMap::iterator i = fav_icon_map_.find(result.index); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // The decoder will leave our bitmap empty on error. | 175 // The decoder will leave our bitmap empty on error. |
| 178 gfx::PNGCodec::Decode(data->front(), data->size(), | 176 gfx::PNGCodec::Decode(data->front(), data->size(), |
| 179 &(fav_icon_map_[index])); | 177 &(fav_icon_map_[index])); |
| 180 | 178 |
| 181 // Notify the observer. | 179 // Notify the observer. |
| 182 if (!fav_icon_map_[index].isNull() && observer_) | 180 if (!fav_icon_map_[index].isNull() && observer_) |
| 183 observer_->OnItemsChanged(static_cast<int>(index), 1); | 181 observer_->OnItemsChanged(static_cast<int>(index), 1); |
| 184 } | 182 } |
| 185 } | 183 } |
| 186 } | 184 } |
| OLD | NEW |