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

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

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/text_elider.h"
11 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
12 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
13 #include "chrome/browser/metrics/user_metrics.h" 12 #include "chrome/browser/metrics/user_metrics.h"
14 #include "chrome/browser/tab_contents/navigation_controller.h" 13 #include "chrome/browser/tab_contents/navigation_controller.h"
15 #include "chrome/browser/tab_contents/navigation_entry.h" 14 #include "chrome/browser/tab_contents/navigation_entry.h"
16 #include "chrome/browser/tab_contents/tab_contents.h" 15 #include "chrome/browser/tab_contents/tab_contents.h"
17 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
22 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
24 #include "net/base/registry_controlled_domain.h" 23 #include "net/base/registry_controlled_domain.h"
24 #include "ui/base/text/text_elider.h"
25 25
26 const int BackForwardMenuModel::kMaxHistoryItems = 12; 26 const int BackForwardMenuModel::kMaxHistoryItems = 12;
27 const int BackForwardMenuModel::kMaxChapterStops = 5; 27 const int BackForwardMenuModel::kMaxChapterStops = 5;
28 static const int kMaxWidth = 700; 28 static const int kMaxWidth = 700;
29 29
30 BackForwardMenuModel::BackForwardMenuModel(Browser* browser, 30 BackForwardMenuModel::BackForwardMenuModel(Browser* browser,
31 ModelType model_type) 31 ModelType model_type)
32 : browser_(browser), 32 : browser_(browser),
33 test_tab_contents_(NULL), 33 test_tab_contents_(NULL),
34 model_type_(model_type) { 34 model_type_(model_type) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Return an empty string for a separator. 75 // Return an empty string for a separator.
76 if (IsSeparator(index)) 76 if (IsSeparator(index))
77 return string16(); 77 return string16();
78 78
79 // Return the entry title, escaping any '&' characters and eliding it if it's 79 // Return the entry title, escaping any '&' characters and eliding it if it's
80 // super long. 80 // super long.
81 NavigationEntry* entry = GetNavigationEntry(index); 81 NavigationEntry* entry = GetNavigationEntry(index);
82 string16 menu_text(entry->GetTitleForDisplay( 82 string16 menu_text(entry->GetTitleForDisplay(
83 GetTabContents()->profile()->GetPrefs()-> 83 GetTabContents()->profile()->GetPrefs()->
84 GetString(prefs::kAcceptLanguages))); 84 GetString(prefs::kAcceptLanguages)));
85 menu_text = gfx::ElideText(menu_text, gfx::Font(), kMaxWidth, false); 85 menu_text = ui::ElideText(menu_text, gfx::Font(), kMaxWidth, false);
86 86
87 for (size_t i = menu_text.find('&'); i != string16::npos; 87 for (size_t i = menu_text.find('&'); i != string16::npos;
88 i = menu_text.find('&', i + 2)) { 88 i = menu_text.find('&', i + 2)) {
89 menu_text.insert(i, 1, '&'); 89 menu_text.insert(i, 1, '&');
90 } 90 }
91 return menu_text; 91 return menu_text;
92 } 92 }
93 93
94 bool BackForwardMenuModel::IsItemDynamicAt(int index) const { 94 bool BackForwardMenuModel::IsItemDynamicAt(int index) const {
95 // This object is only used for a single showing of a menu. 95 // This object is only used for a single showing of a menu.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 metric_string += "ForwardMenu_"; 374 metric_string += "ForwardMenu_";
375 else 375 else
376 metric_string += "BackMenu_"; 376 metric_string += "BackMenu_";
377 metric_string += action; 377 metric_string += action;
378 if (index != -1) { 378 if (index != -1) {
379 // +1 is for historical reasons (indices used to start at 1). 379 // +1 is for historical reasons (indices used to start at 1).
380 metric_string += base::IntToString(index + 1); 380 metric_string += base::IntToString(index + 1);
381 } 381 }
382 return metric_string; 382 return metric_string;
383 } 383 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/login/login_prompt_gtk.cc ('k') | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698