| 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/encoding_menu_controller.h" |    5 #include "chrome/browser/encoding_menu_controller.h" | 
|    6  |    6  | 
|    7 #include "app/l10n_util.h" |    7 #include "app/l10n_util.h" | 
|    8 #include "base/i18n/rtl.h" |    8 #include "base/i18n/rtl.h" | 
|    9 #include "base/utf_string_conversions.h" |    9 #include "base/utf_string_conversions.h" | 
|   10 #include "chrome/app/chrome_command_ids.h" |   10 #include "chrome/app/chrome_command_ids.h" | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  124       profile->GetPrefs()->GetString(prefs::kStaticEncodings), |  124       profile->GetPrefs()->GetString(prefs::kStaticEncodings), | 
|  125       profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding)); |  125       profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding)); | 
|  126   DCHECK(encodings); |  126   DCHECK(encodings); | 
|  127   DCHECK(!encodings->empty()); |  127   DCHECK(!encodings->empty()); | 
|  128  |  128  | 
|  129   // Build up output list for menu. |  129   // Build up output list for menu. | 
|  130   std::vector<CharacterEncoding::EncodingInfo>::const_iterator it; |  130   std::vector<CharacterEncoding::EncodingInfo>::const_iterator it; | 
|  131   for (it = encodings->begin(); it != encodings->end(); ++it) { |  131   for (it = encodings->begin(); it != encodings->end(); ++it) { | 
|  132     if (it->encoding_id) { |  132     if (it->encoding_id) { | 
|  133       std::wstring encoding = it->encoding_display_name; |  133       std::wstring encoding = it->encoding_display_name; | 
|  134       std::wstring bidi_safe_encoding; |  134       base::i18n::AdjustStringForLocaleDirection(&encoding); | 
|  135       if (base::i18n::AdjustStringForLocaleDirection(encoding, |  | 
|  136                                                      &bidi_safe_encoding)) |  | 
|  137         encoding.swap(bidi_safe_encoding); |  | 
|  138       menuItems->push_back(EncodingMenuItem(it->encoding_id, |  135       menuItems->push_back(EncodingMenuItem(it->encoding_id, | 
|  139                                             WideToUTF16(encoding))); |  136                                             WideToUTF16(encoding))); | 
|  140     } else { |  137     } else { | 
|  141       menuItems->push_back(separator); |  138       menuItems->push_back(separator); | 
|  142     } |  139     } | 
|  143   } |  140   } | 
|  144 } |  141 } | 
| OLD | NEW |