| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 Settings* settings = GetFrame()->GetSettings(); | 69 Settings* settings = GetFrame()->GetSettings(); |
| 70 if (!settings || !settings->GetCookieEnabled()) | 70 if (!settings || !settings->GetCookieEnabled()) |
| 71 return false; | 71 return false; |
| 72 | 72 |
| 73 return CookiesEnabled(GetFrame()->GetDocument()); | 73 return CookiesEnabled(GetFrame()->GetDocument()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Vector<String> Navigator::languages() { | 76 Vector<String> Navigator::languages() { |
| 77 Vector<String> languages; | 77 Vector<String> languages; |
| 78 languages_changed_ = false; |
| 78 | 79 |
| 79 if (!GetFrame() || !GetFrame()->GetPage()) { | 80 if (!GetFrame() || !GetFrame()->GetPage()) { |
| 80 languages.push_back(DefaultLanguage()); | 81 languages.push_back(DefaultLanguage()); |
| 81 return languages; | 82 return languages; |
| 82 } | 83 } |
| 83 | 84 |
| 84 String accept_languages = | 85 String accept_languages = |
| 85 GetFrame()->GetPage()->GetChromeClient().AcceptLanguages(); | 86 GetFrame()->GetPage()->GetChromeClient().AcceptLanguages(); |
| 86 accept_languages.Split(',', languages); | 87 accept_languages.Split(',', languages); |
| 87 | 88 |
| 88 // Sanitizing tokens. We could do that more extensively but we should assume | 89 // Sanitizing tokens. We could do that more extensively but we should assume |
| 89 // that the accept languages are already sane and support BCP47. It is | 90 // that the accept languages are already sane and support BCP47. It is |
| 90 // likely a waste of time to make sure the tokens matches that spec here. | 91 // likely a waste of time to make sure the tokens matches that spec here. |
| 91 for (size_t i = 0; i < languages.size(); ++i) { | 92 for (size_t i = 0; i < languages.size(); ++i) { |
| 92 String& token = languages[i]; | 93 String& token = languages[i]; |
| 93 token = token.StripWhiteSpace(); | 94 token = token.StripWhiteSpace(); |
| 94 if (token.length() >= 3 && token[2] == '_') | 95 if (token.length() >= 3 && token[2] == '_') |
| 95 token.replace(2, 1, "-"); | 96 token.replace(2, 1, "-"); |
| 96 } | 97 } |
| 97 | 98 |
| 98 return languages; | 99 return languages; |
| 99 } | 100 } |
| 100 | 101 |
| 101 DEFINE_TRACE(Navigator) { | 102 DEFINE_TRACE(Navigator) { |
| 102 DOMWindowClient::Trace(visitor); | 103 DOMWindowClient::Trace(visitor); |
| 103 Supplementable<Navigator>::Trace(visitor); | 104 Supplementable<Navigator>::Trace(visitor); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |