| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |