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

Unified Diff: chrome/browser/extensions/extension_menu_manager.cc

Issue 3017047: Set a max limit on extension items' labels in context menus.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_menu_manager.h ('k') | chrome/browser/extensions/extension_test_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_menu_manager.cc
===================================================================
--- chrome/browser/extensions/extension_menu_manager.cc (revision 54510)
+++ chrome/browser/extensions/extension_menu_manager.cc (working copy)
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "app/l10n_util.h"
#include "base/logging.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
@@ -76,11 +77,16 @@
}
string16 ExtensionMenuItem::TitleWithReplacement(
- const string16& selection) const {
+ const string16& selection, size_t max_length) const {
string16 result = UTF8ToUTF16(title_);
// TODO(asargent) - Change this to properly handle %% escaping so you can
// put "%s" in titles that won't get substituted.
ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16("%s"), selection);
+
+ if (result.length() > max_length) {
+ result = WideToUTF16(l10n_util::TruncateString(UTF16ToWideHack(result),
+ max_length));
+ }
return result;
}
« no previous file with comments | « chrome/browser/extensions/extension_menu_manager.h ('k') | chrome/browser/extensions/extension_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698