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

Side by Side Diff: chrome/browser/extensions/extension_menu_manager.cc

Issue 5742006: wstrings: make l10n_util::TruncateString use string16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | chrome/browser/gtk/bookmark_menu_controller_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/extension_menu_manager.h" 5 #include "chrome/browser/extensions/extension_menu_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return result; 66 return result;
67 } 67 }
68 68
69 string16 ExtensionMenuItem::TitleWithReplacement( 69 string16 ExtensionMenuItem::TitleWithReplacement(
70 const string16& selection, size_t max_length) const { 70 const string16& selection, size_t max_length) const {
71 string16 result = UTF8ToUTF16(title_); 71 string16 result = UTF8ToUTF16(title_);
72 // TODO(asargent) - Change this to properly handle %% escaping so you can 72 // TODO(asargent) - Change this to properly handle %% escaping so you can
73 // put "%s" in titles that won't get substituted. 73 // put "%s" in titles that won't get substituted.
74 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16("%s"), selection); 74 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16("%s"), selection);
75 75
76 if (result.length() > max_length) { 76 if (result.length() > max_length)
77 result = WideToUTF16(l10n_util::TruncateString(UTF16ToWideHack(result), 77 result = l10n_util::TruncateString(result, max_length);
78 max_length));
79 }
80 return result; 78 return result;
81 } 79 }
82 80
83 bool ExtensionMenuItem::SetChecked(bool checked) { 81 bool ExtensionMenuItem::SetChecked(bool checked) {
84 if (type_ != CHECKBOX && type_ != RADIO) 82 if (type_ != CHECKBOX && type_ != RADIO)
85 return false; 83 return false;
86 checked_ = checked; 84 checked_ = checked;
87 return true; 85 return true;
88 } 86 }
89 87
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if (profile < other.profile) 495 if (profile < other.profile)
498 return true; 496 return true;
499 if (profile == other.profile) { 497 if (profile == other.profile) {
500 if (extension_id < other.extension_id) 498 if (extension_id < other.extension_id)
501 return true; 499 return true;
502 if (extension_id == other.extension_id) 500 if (extension_id == other.extension_id)
503 return uid < other.uid; 501 return uid < other.uid;
504 } 502 }
505 return false; 503 return false;
506 } 504 }
OLDNEW
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | chrome/browser/gtk/bookmark_menu_controller_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698