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

Side by Side Diff: base/string_util.h

Issue 6982011: Strip leading "javascript:" schemas from text pasted or dropped into the omnibox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
« no previous file with comments | « no previous file | base/string_util.cc » ('j') | base/string_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file defines utility functions for working with strings. 5 // This file defines utility functions for working with strings.
6 6
7 #ifndef BASE_STRING_UTIL_H_ 7 #ifndef BASE_STRING_UTIL_H_
8 #define BASE_STRING_UTIL_H_ 8 #define BASE_STRING_UTIL_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 BASE_API std::string ReplaceStringPlaceholders( 522 BASE_API std::string ReplaceStringPlaceholders(
523 const base::StringPiece& format_string, 523 const base::StringPiece& format_string,
524 const std::vector<std::string>& subst, 524 const std::vector<std::string>& subst,
525 std::vector<size_t>* offsets); 525 std::vector<size_t>* offsets);
526 526
527 // Single-string shortcut for ReplaceStringHolders. |offset| may be NULL. 527 // Single-string shortcut for ReplaceStringHolders. |offset| may be NULL.
528 BASE_API string16 ReplaceStringPlaceholders(const string16& format_string, 528 BASE_API string16 ReplaceStringPlaceholders(const string16& format_string,
529 const string16& a, 529 const string16& a,
530 size_t* offset); 530 size_t* offset);
531 531
532 // Strips any leading javascript schemas from a string.
Peter Kasting 2011/05/10 23:27:42 This does not belong in base/; it is not generic e
Cris Neckar 2011/05/11 21:42:36 Done.
533 // Returns true if the output string differs from the input.
534 BASE_API bool StripJavascriptSchema(const string16&, string16*);
535
532 // Returns true if the string passed in matches the pattern. The pattern 536 // Returns true if the string passed in matches the pattern. The pattern
533 // string can contain wildcards like * and ? 537 // string can contain wildcards like * and ?
534 // The backslash character (\) is an escape character for * and ? 538 // The backslash character (\) is an escape character for * and ?
535 // We limit the patterns to having a max of 16 * or ? characters. 539 // We limit the patterns to having a max of 16 * or ? characters.
536 // ? matches 0 or 1 character, while * matches 0 or more characters. 540 // ? matches 0 or 1 character, while * matches 0 or more characters.
537 BASE_API bool MatchPattern(const base::StringPiece& string, 541 BASE_API bool MatchPattern(const base::StringPiece& string,
538 const base::StringPiece& pattern); 542 const base::StringPiece& pattern);
539 BASE_API bool MatchPattern(const string16& string, const string16& pattern); 543 BASE_API bool MatchPattern(const string16& string, const string16& pattern);
540 544
541 // Hack to convert any char-like type to its unsigned counterpart. 545 // Hack to convert any char-like type to its unsigned counterpart.
(...skipping 19 matching lines...) Expand all
561 #elif defined(WCHAR_T_IS_UTF32) 565 #elif defined(WCHAR_T_IS_UTF32)
562 typedef uint32 Unsigned; 566 typedef uint32 Unsigned;
563 #endif 567 #endif
564 }; 568 };
565 template<> 569 template<>
566 struct ToUnsigned<short> { 570 struct ToUnsigned<short> {
567 typedef unsigned short Unsigned; 571 typedef unsigned short Unsigned;
568 }; 572 };
569 573
570 #endif // BASE_STRING_UTIL_H_ 574 #endif // BASE_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/string_util.cc » ('j') | base/string_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698