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

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

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 6 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
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/extensions/menu_manager.h" 5 #include "chrome/browser/extensions/menu_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 STLDeleteElements(&children_); 166 STLDeleteElements(&children_);
167 return result; 167 return result;
168 } 168 }
169 169
170 base::string16 MenuItem::TitleWithReplacement(const base::string16& selection, 170 base::string16 MenuItem::TitleWithReplacement(const base::string16& selection,
171 size_t max_length) const { 171 size_t max_length) const {
172 base::string16 result = base::UTF8ToUTF16(title_); 172 base::string16 result = base::UTF8ToUTF16(title_);
173 // TODO(asargent) - Change this to properly handle %% escaping so you can 173 // TODO(asargent) - Change this to properly handle %% escaping so you can
174 // put "%s" in titles that won't get substituted. 174 // put "%s" in titles that won't get substituted.
175 ReplaceSubstringsAfterOffset(&result, 0, base::ASCIIToUTF16("%s"), selection); 175 base::ReplaceSubstringsAfterOffset(
176 &result, 0, base::ASCIIToUTF16("%s"), selection);
176 177
177 if (result.length() > max_length) 178 if (result.length() > max_length)
178 result = gfx::TruncateString(result, max_length, gfx::WORD_BREAK); 179 result = gfx::TruncateString(result, max_length, gfx::WORD_BREAK);
179 return result; 180 return result;
180 } 181 }
181 182
182 bool MenuItem::SetChecked(bool checked) { 183 bool MenuItem::SetChecked(bool checked) {
183 if (type_ != CHECKBOX && type_ != RADIO) 184 if (type_ != CHECKBOX && type_ != RADIO)
184 return false; 185 return false;
185 checked_ = checked; 186 checked_ = checked;
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 if (uid < other.uid) 941 if (uid < other.uid)
941 return true; 942 return true;
942 if (uid == other.uid) 943 if (uid == other.uid)
943 return string_uid < other.string_uid; 944 return string_uid < other.string_uid;
944 } 945 }
945 } 946 }
946 return false; 947 return false;
947 } 948 }
948 949
949 } // namespace extensions 950 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698