| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (!settings || !settings->cookieEnabled()) | 70 if (!settings || !settings->cookieEnabled()) |
| 71 return false; | 71 return false; |
| 72 | 72 |
| 73 return cookiesEnabled(frame()->document()); | 73 return cookiesEnabled(frame()->document()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Vector<String> Navigator::languages() { | 76 Vector<String> Navigator::languages() { |
| 77 Vector<String> languages; | 77 Vector<String> languages; |
| 78 | 78 |
| 79 if (!frame() || !frame()->host()) { | 79 if (!frame() || !frame()->host()) { |
| 80 languages.append(defaultLanguage()); | 80 languages.push_back(defaultLanguage()); |
| 81 return languages; | 81 return languages; |
| 82 } | 82 } |
| 83 | 83 |
| 84 String acceptLanguages = frame()->host()->chromeClient().acceptLanguages(); | 84 String acceptLanguages = frame()->host()->chromeClient().acceptLanguages(); |
| 85 acceptLanguages.split(',', languages); | 85 acceptLanguages.split(',', languages); |
| 86 | 86 |
| 87 // Sanitizing tokens. We could do that more extensively but we should assume | 87 // Sanitizing tokens. We could do that more extensively but we should assume |
| 88 // that the accept languages are already sane and support BCP47. It is | 88 // that the accept languages are already sane and support BCP47. It is |
| 89 // likely a waste of time to make sure the tokens matches that spec here. | 89 // likely a waste of time to make sure the tokens matches that spec here. |
| 90 for (size_t i = 0; i < languages.size(); ++i) { | 90 for (size_t i = 0; i < languages.size(); ++i) { |
| 91 String& token = languages[i]; | 91 String& token = languages[i]; |
| 92 token = token.stripWhiteSpace(); | 92 token = token.stripWhiteSpace(); |
| 93 if (token.length() >= 3 && token[2] == '_') | 93 if (token.length() >= 3 && token[2] == '_') |
| 94 token.replace(2, 1, "-"); | 94 token.replace(2, 1, "-"); |
| 95 } | 95 } |
| 96 | 96 |
| 97 return languages; | 97 return languages; |
| 98 } | 98 } |
| 99 | 99 |
| 100 DEFINE_TRACE(Navigator) { | 100 DEFINE_TRACE(Navigator) { |
| 101 DOMWindowProperty::trace(visitor); | 101 DOMWindowProperty::trace(visitor); |
| 102 Supplementable<Navigator>::trace(visitor); | 102 Supplementable<Navigator>::trace(visitor); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |