| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/toolbar/back_forward_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return base::string16(); | 100 return base::string16(); |
| 101 | 101 |
| 102 // Return the entry title, escaping any '&' characters and eliding it if it's | 102 // Return the entry title, escaping any '&' characters and eliding it if it's |
| 103 // super long. | 103 // super long. |
| 104 NavigationEntry* entry = GetNavigationEntry(index); | 104 NavigationEntry* entry = GetNavigationEntry(index); |
| 105 Profile* profile = | 105 Profile* profile = |
| 106 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()); | 106 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()); |
| 107 base::string16 menu_text(entry->GetTitleForDisplay( | 107 base::string16 menu_text(entry->GetTitleForDisplay( |
| 108 profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); | 108 profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); |
| 109 menu_text = | 109 menu_text = |
| 110 gfx::ElideText(menu_text, gfx::FontList(), kMaxWidth, gfx::ELIDE_AT_END); | 110 gfx::ElideText(menu_text, gfx::FontList(), kMaxWidth, gfx::ELIDE_TAIL); |
| 111 | 111 |
| 112 #if !defined(OS_MACOSX) | 112 #if !defined(OS_MACOSX) |
| 113 for (size_t i = menu_text.find('&'); i != base::string16::npos; | 113 for (size_t i = menu_text.find('&'); i != base::string16::npos; |
| 114 i = menu_text.find('&', i + 2)) { | 114 i = menu_text.find('&', i + 2)) { |
| 115 menu_text.insert(i, 1, '&'); | 115 menu_text.insert(i, 1, '&'); |
| 116 } | 116 } |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 return menu_text; | 119 return menu_text; |
| 120 } | 120 } |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 metric_string += "ForwardMenu_"; | 474 metric_string += "ForwardMenu_"; |
| 475 else | 475 else |
| 476 metric_string += "BackMenu_"; | 476 metric_string += "BackMenu_"; |
| 477 metric_string += action; | 477 metric_string += action; |
| 478 if (index != -1) { | 478 if (index != -1) { |
| 479 // +1 is for historical reasons (indices used to start at 1). | 479 // +1 is for historical reasons (indices used to start at 1). |
| 480 metric_string += base::IntToString(index + 1); | 480 metric_string += base::IntToString(index + 1); |
| 481 } | 481 } |
| 482 return metric_string; | 482 return metric_string; |
| 483 } | 483 } |
| OLD | NEW |