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

Side by Side Diff: chrome/browser/ui/toolbar/back_forward_menu_model.cc

Issue 23731010: Move text_elider to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update3 Created 7 years, 3 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) 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 10 matching lines...) Expand all
21 #include "content/public/browser/favicon_status.h" 21 #include "content/public/browser/favicon_status.h"
22 #include "content/public/browser/navigation_controller.h" 22 #include "content/public/browser/navigation_controller.h"
23 #include "content/public/browser/navigation_entry.h" 23 #include "content/public/browser/navigation_entry.h"
24 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
28 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 28 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/base/text/text_elider.h"
32 #include "ui/base/window_open_disposition.h" 31 #include "ui/base/window_open_disposition.h"
33 #include "ui/gfx/favicon_size.h" 32 #include "ui/gfx/favicon_size.h"
33 #include "ui/gfx/text_elider.h"
34 34
35 using content::NavigationController; 35 using content::NavigationController;
36 using content::NavigationEntry; 36 using content::NavigationEntry;
37 using content::UserMetricsAction; 37 using content::UserMetricsAction;
38 using content::WebContents; 38 using content::WebContents;
39 39
40 const int BackForwardMenuModel::kMaxHistoryItems = 12; 40 const int BackForwardMenuModel::kMaxHistoryItems = 12;
41 const int BackForwardMenuModel::kMaxChapterStops = 5; 41 const int BackForwardMenuModel::kMaxChapterStops = 5;
42 static const int kMaxWidth = 700; 42 static const int kMaxWidth = 700;
43 43
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return string16(); 100 return 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 string16 menu_text(entry->GetTitleForDisplay( 107 string16 menu_text(entry->GetTitleForDisplay(
108 profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); 108 profile->GetPrefs()->GetString(prefs::kAcceptLanguages)));
109 menu_text = 109 menu_text =
110 ui::ElideText(menu_text, gfx::Font(), kMaxWidth, ui::ELIDE_AT_END); 110 gfx::ElideText(menu_text, gfx::Font(), kMaxWidth, gfx::ELIDE_AT_END);
111 111
112 #if !defined(OS_MACOSX) 112 #if !defined(OS_MACOSX)
113 for (size_t i = menu_text.find('&'); i != string16::npos; 113 for (size_t i = menu_text.find('&'); i != 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 metric_string += "ForwardMenu_"; 476 metric_string += "ForwardMenu_";
477 else 477 else
478 metric_string += "BackMenu_"; 478 metric_string += "BackMenu_";
479 metric_string += action; 479 metric_string += action;
480 if (index != -1) { 480 if (index != -1) {
481 // +1 is for historical reasons (indices used to start at 1). 481 // +1 is for historical reasons (indices used to start at 1).
482 metric_string += base::IntToString(index + 1); 482 metric_string += base::IntToString(index + 1);
483 } 483 }
484 return metric_string; 484 return metric_string;
485 } 485 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/location_bar_util.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698