| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/toolbar/back_forward_menu_model.h" | 7 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (IsSeparator(index)) | 85 if (IsSeparator(index)) |
| 86 return string16(); | 86 return string16(); |
| 87 | 87 |
| 88 // Return the entry title, escaping any '&' characters and eliding it if it's | 88 // Return the entry title, escaping any '&' characters and eliding it if it's |
| 89 // super long. | 89 // super long. |
| 90 NavigationEntry* entry = GetNavigationEntry(index); | 90 NavigationEntry* entry = GetNavigationEntry(index); |
| 91 Profile* profile = | 91 Profile* profile = |
| 92 Profile::FromBrowserContext(GetTabContents()->browser_context()); | 92 Profile::FromBrowserContext(GetTabContents()->browser_context()); |
| 93 string16 menu_text(entry->GetTitleForDisplay( | 93 string16 menu_text(entry->GetTitleForDisplay( |
| 94 profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); | 94 profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); |
| 95 menu_text = ui::ElideText(menu_text, gfx::Font(), kMaxWidth, false); | 95 menu_text = |
| 96 ui::ElideText(menu_text, gfx::Font(), kMaxWidth, ui::ELIDE_AT_END); |
| 96 | 97 |
| 97 #if !defined(OS_MACOSX) | 98 #if !defined(OS_MACOSX) |
| 98 for (size_t i = menu_text.find('&'); i != string16::npos; | 99 for (size_t i = menu_text.find('&'); i != string16::npos; |
| 99 i = menu_text.find('&', i + 2)) { | 100 i = menu_text.find('&', i + 2)) { |
| 100 menu_text.insert(i, 1, '&'); | 101 menu_text.insert(i, 1, '&'); |
| 101 } | 102 } |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 return menu_text; | 105 return menu_text; |
| 105 } | 106 } |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 metric_string += "ForwardMenu_"; | 455 metric_string += "ForwardMenu_"; |
| 455 else | 456 else |
| 456 metric_string += "BackMenu_"; | 457 metric_string += "BackMenu_"; |
| 457 metric_string += action; | 458 metric_string += action; |
| 458 if (index != -1) { | 459 if (index != -1) { |
| 459 // +1 is for historical reasons (indices used to start at 1). | 460 // +1 is for historical reasons (indices used to start at 1). |
| 460 metric_string += base::IntToString(index + 1); | 461 metric_string += base::IntToString(index + 1); |
| 461 } | 462 } |
| 462 return metric_string; | 463 return metric_string; |
| 463 } | 464 } |
| OLD | NEW |