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

Side by Side Diff: webkit/mocks/mock_webhyphenator.cc

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "webkit/mocks/mock_webhyphenator.h" 5 #include "webkit/mocks/mock_webhyphenator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_handle.h" 8 #include "base/memory/scoped_handle.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 size_t before_index, 50 size_t before_index,
51 const WebKit::WebString& locale) { 51 const WebKit::WebString& locale) {
52 DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") || 52 DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") ||
53 locale.equals("en_GB")); 53 locale.equals("en_GB"));
54 if (!hyphen_dictionary_) 54 if (!hyphen_dictionary_)
55 return 0; 55 return 0;
56 56
57 // Retrieve the positions where we can insert hyphens. This function assumes 57 // Retrieve the positions where we can insert hyphens. This function assumes
58 // the input word is an English word so it can use the position returned by 58 // the input word is an English word so it can use the position returned by
59 // the hyphen library without conversion. 59 // the hyphen library without conversion.
60 string16 word_utf16(characters, length); 60 base::string16 word_utf16(characters, length);
61 if (!IsStringASCII(word_utf16)) 61 if (!IsStringASCII(word_utf16))
62 return 0; 62 return 0;
63 std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16)); 63 std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16));
64 scoped_array<char> hyphens(new char[word.length() + 5]); 64 scoped_array<char> hyphens(new char[word.length() + 5]);
65 char** rep = NULL; 65 char** rep = NULL;
66 int* pos = NULL; 66 int* pos = NULL;
67 int* cut = NULL; 67 int* cut = NULL;
68 int error = hnj_hyphen_hyphenate2(hyphen_dictionary_, 68 int error = hnj_hyphen_hyphenate2(hyphen_dictionary_,
69 word.data(), 69 word.data(),
70 static_cast<int>(word.length()), 70 static_cast<int>(word.length()),
(...skipping 24 matching lines...) Expand all
95 if (before_index >= 2) { 95 if (before_index >= 2) {
96 for (size_t index = before_index - 2; index > 0; --index) { 96 for (size_t index = before_index - 2; index > 0; --index) {
97 if (hyphens[index] & 1) 97 if (hyphens[index] & 1)
98 return index + 1; 98 return index + 1;
99 } 99 }
100 } 100 }
101 return 0; 101 return 0;
102 } 102 }
103 103
104 } // namespace webkit_glue 104 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698