OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/back_forward_menu_model.h" | 7 #include "chrome/browser/back_forward_menu_model.h" |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Otherwise, look to see if we have reached the separator for the | 198 // Otherwise, look to see if we have reached the separator for the |
199 // chapter-stops. If not, this is a chapter stop. | 199 // chapter-stops. If not, this is a chapter stop. |
200 return (menu_id == history_items + 1 + | 200 return (menu_id == history_items + 1 + |
201 chapter_stops + 1); | 201 chapter_stops + 1); |
202 } | 202 } |
203 | 203 |
204 // Look to see if we have reached the separator for the history items. | 204 // Look to see if we have reached the separator for the history items. |
205 return menu_id == history_items + 1; | 205 return menu_id == history_items + 1; |
206 } | 206 } |
207 | 207 |
208 std::wstring BackForwardMenuModel::GetItemLabel(int menu_id) const { | 208 string16 BackForwardMenuModel::GetItemLabel(int menu_id) const { |
209 // Return label "Show Full History" for the last item of the menu. | 209 // Return label "Show Full History" for the last item of the menu. |
210 if (menu_id == GetTotalItemCount()) | 210 if (menu_id == GetTotalItemCount()) |
211 return l10n_util::GetString(IDS_SHOWFULLHISTORY_LINK); | 211 return l10n_util::GetStringUTF16(IDS_SHOWFULLHISTORY_LINK); |
212 | 212 |
213 // Return an empty string for a separator. | 213 // Return an empty string for a separator. |
214 if (IsSeparator(menu_id)) | 214 if (IsSeparator(menu_id)) |
215 return L""; | 215 return string16(); |
216 | 216 |
217 NavigationEntry* entry = GetNavigationEntry(menu_id); | 217 NavigationEntry* entry = GetNavigationEntry(menu_id); |
218 return UTF16ToWideHack(entry->GetTitleForDisplay( | 218 return entry->GetTitleForDisplay(&GetTabContents()->controller()); |
219 &GetTabContents()->controller())); | |
220 } | 219 } |
221 | 220 |
222 const SkBitmap& BackForwardMenuModel::GetItemIcon(int menu_id) const { | 221 const SkBitmap& BackForwardMenuModel::GetItemIcon(int menu_id) const { |
223 DCHECK(ItemHasIcon(menu_id)); | 222 DCHECK(ItemHasIcon(menu_id)); |
224 | 223 |
225 if (menu_id == GetTotalItemCount()) { | 224 if (menu_id == GetTotalItemCount()) { |
226 return *ResourceBundle::GetSharedInstance().GetBitmapNamed( | 225 return *ResourceBundle::GetSharedInstance().GetBitmapNamed( |
227 IDR_HISTORY_FAVICON); | 226 IDR_HISTORY_FAVICON); |
228 } | 227 } |
229 | 228 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 std::wstring metric_string; | 291 std::wstring metric_string; |
293 if (model_type_ == FORWARD_MENU) | 292 if (model_type_ == FORWARD_MENU) |
294 metric_string += L"ForwardMenu_"; | 293 metric_string += L"ForwardMenu_"; |
295 else | 294 else |
296 metric_string += L"BackMenu_"; | 295 metric_string += L"BackMenu_"; |
297 metric_string += action; | 296 metric_string += action; |
298 if (index != -1) | 297 if (index != -1) |
299 metric_string += IntToWString(index); | 298 metric_string += IntToWString(index); |
300 return metric_string; | 299 return metric_string; |
301 } | 300 } |
OLD | NEW |