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

Side by Side Diff: Source/core/frame/Navigator.cpp

Issue 359903002: Call WTFString::split(UChar, Vector&) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests as well Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 Vector<String> Navigator::languages() 130 Vector<String> Navigator::languages()
131 { 131 {
132 Vector<String> languages; 132 Vector<String> languages;
133 133
134 if (!m_frame || !m_frame->host()) { 134 if (!m_frame || !m_frame->host()) {
135 languages.append(defaultLanguage()); 135 languages.append(defaultLanguage());
136 return languages; 136 return languages;
137 } 137 }
138 138
139 String acceptLanguages = m_frame->host()->chrome().client().acceptLanguages( ); 139 String acceptLanguages = m_frame->host()->chrome().client().acceptLanguages( );
140 acceptLanguages.split(",", languages); 140 acceptLanguages.split(',', languages);
141 141
142 // Sanitizing tokens. We could do that more extensively but we should assume 142 // Sanitizing tokens. We could do that more extensively but we should assume
143 // that the accept languages are already sane and support BCP47. It is 143 // that the accept languages are already sane and support BCP47. It is
144 // likely a waste of time to make sure the tokens matches that spec here. 144 // likely a waste of time to make sure the tokens matches that spec here.
145 for (size_t i = 0; i < languages.size(); ++i) { 145 for (size_t i = 0; i < languages.size(); ++i) {
146 String& token = languages[i]; 146 String& token = languages[i];
147 token = token.stripWhiteSpace(); 147 token = token.stripWhiteSpace();
148 if (token.length() >= 3 && token[2] == '_') 148 if (token.length() >= 3 && token[2] == '_')
149 token.replace(2, 1, "-"); 149 token.replace(2, 1, "-");
150 } 150 }
151 151
152 return languages; 152 return languages;
153 } 153 }
154 154
155 void Navigator::trace(Visitor* visitor) 155 void Navigator::trace(Visitor* visitor)
156 { 156 {
157 visitor->trace(m_plugins); 157 visitor->trace(m_plugins);
158 visitor->trace(m_mimeTypes); 158 visitor->trace(m_mimeTypes);
159 WillBeHeapSupplementable<Navigator>::trace(visitor); 159 WillBeHeapSupplementable<Navigator>::trace(visitor);
160 } 160 }
161 161
162 } // namespace WebCore 162 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/CompositionUnderlineRangeFilterTest.cpp ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698