Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Side by Side Diff: chrome/browser/possible_url_model.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/possible_url_model.h" 5 #include "chrome/browser/possible_url_model.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 "app/table_model_observer.h" 9 #include "app/table_model_observer.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/i18n/rtl.h"
11 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/cancelable_request.h" 13 #include "chrome/browser/cancelable_request.h"
13 #include "chrome/browser/favicon_service.h" 14 #include "chrome/browser/favicon_service.h"
14 #include "chrome/browser/pref_service.h" 15 #include "chrome/browser/pref_service.h"
15 #include "chrome/browser/profile.h" 16 #include "chrome/browser/profile.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "gfx/codec/png_codec.h" 18 #include "gfx/codec/png_codec.h"
18 #include "grit/app_resources.h" 19 #include "grit/app_resources.h"
19 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
20 21
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 NOTREACHED(); 107 NOTREACHED();
107 return std::wstring(); 108 return std::wstring();
108 } 109 }
109 110
110 if (col_id == IDS_ASI_PAGE_COLUMN) { 111 if (col_id == IDS_ASI_PAGE_COLUMN) {
111 const std::wstring& title = GetTitle(row); 112 const std::wstring& title = GetTitle(row);
112 // TODO(xji): Consider adding a special case if the title text is a URL, 113 // TODO(xji): Consider adding a special case if the title text is a URL,
113 // since those should always have LTR directionality. Please refer to 114 // since those should always have LTR directionality. Please refer to
114 // http://crbug.com/6726 for more information. 115 // http://crbug.com/6726 for more information.
115 std::wstring localized_title; 116 std::wstring localized_title;
116 if (l10n_util::AdjustStringForLocaleDirection(title, &localized_title)) 117 if (base::i18n::AdjustStringForLocaleDirection(title, &localized_title))
117 return localized_title; 118 return localized_title;
118 return title; 119 return title;
119 } 120 }
120 121
121 // TODO(brettw): this should probably pass the GURL up so the URL elider 122 // 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. 123 // can be used at a higher level when we know the width.
123 const string16& url = results_[row].display_url.display_url(); 124 const string16& url = results_[row].display_url.display_url();
124 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) 125 if (!base::i18n::IsRTL())
125 return UTF16ToWideHack(url); 126 return UTF16ToWideHack(url);
126 // Force URL to be LTR. 127 // Force URL to be LTR.
127 std::wstring localized_url = UTF16ToWideHack(url); 128 std::wstring localized_url = UTF16ToWideHack(url);
128 l10n_util::WrapStringWithLTRFormatting(&localized_url); 129 base::i18n::WrapStringWithLTRFormatting(&localized_url);
129 return localized_url; 130 return localized_url;
130 } 131 }
131 132
132 SkBitmap PossibleURLModel::GetIcon(int row) { 133 SkBitmap PossibleURLModel::GetIcon(int row) {
133 if (row < 0 || row >= RowCount()) { 134 if (row < 0 || row >= RowCount()) {
134 NOTREACHED(); 135 NOTREACHED();
135 return *default_fav_icon; 136 return *default_fav_icon;
136 } 137 }
137 138
138 Result& result = results_[row]; 139 Result& result = results_[row];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // The decoder will leave our bitmap empty on error. 181 // The decoder will leave our bitmap empty on error.
181 gfx::PNGCodec::Decode(data->front(), data->size(), 182 gfx::PNGCodec::Decode(data->front(), data->size(),
182 &(fav_icon_map_[index])); 183 &(fav_icon_map_[index]));
183 184
184 // Notify the observer. 185 // Notify the observer.
185 if (!fav_icon_map_[index].isNull() && observer_) 186 if (!fav_icon_map_[index].isNull() && observer_)
186 observer_->OnItemsChanged(static_cast<int>(index), 1); 187 observer_->OnItemsChanged(static_cast<int>(index), 1);
187 } 188 }
188 } 189 }
189 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/language_combobox_model.cc ('k') | chrome/browser/renderer_host/render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698