| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 String Navigator::vendorSub() const | 57 String Navigator::vendorSub() const |
| 58 { | 58 { |
| 59 return ""; | 59 return ""; |
| 60 } | 60 } |
| 61 | 61 |
| 62 String Navigator::userAgent() const | 62 String Navigator::userAgent() const |
| 63 { | 63 { |
| 64 // If the frame is already detached it no longer has a meaningful useragent. | 64 // If the frame is already detached it no longer has a meaningful useragent. |
| 65 if (!m_frame || !m_frame->page()) | 65 if (!frame() || !frame()->page()) |
| 66 return String(); | 66 return String(); |
| 67 | 67 |
| 68 return m_frame->loader().userAgent(); | 68 return frame()->loader().userAgent(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool Navigator::cookieEnabled() const | 71 bool Navigator::cookieEnabled() const |
| 72 { | 72 { |
| 73 if (!m_frame) | 73 if (!frame()) |
| 74 return false; | 74 return false; |
| 75 | 75 |
| 76 Settings* settings = m_frame->settings(); | 76 Settings* settings = frame()->settings(); |
| 77 if (!settings || !settings->cookieEnabled()) | 77 if (!settings || !settings->cookieEnabled()) |
| 78 return false; | 78 return false; |
| 79 | 79 |
| 80 return cookiesEnabled(m_frame->document()); | 80 return cookiesEnabled(frame()->document()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Vector<String> Navigator::languages() | 83 Vector<String> Navigator::languages() |
| 84 { | 84 { |
| 85 Vector<String> languages; | 85 Vector<String> languages; |
| 86 | 86 |
| 87 if (!m_frame || !m_frame->host()) { | 87 if (!frame() || !frame()->host()) { |
| 88 languages.append(defaultLanguage()); | 88 languages.append(defaultLanguage()); |
| 89 return languages; | 89 return languages; |
| 90 } | 90 } |
| 91 | 91 |
| 92 String acceptLanguages = m_frame->host()->chromeClient().acceptLanguages(); | 92 String acceptLanguages = frame()->host()->chromeClient().acceptLanguages(); |
| 93 acceptLanguages.split(',', languages); | 93 acceptLanguages.split(',', languages); |
| 94 | 94 |
| 95 // Sanitizing tokens. We could do that more extensively but we should assume | 95 // Sanitizing tokens. We could do that more extensively but we should assume |
| 96 // that the accept languages are already sane and support BCP47. It is | 96 // that the accept languages are already sane and support BCP47. It is |
| 97 // likely a waste of time to make sure the tokens matches that spec here. | 97 // likely a waste of time to make sure the tokens matches that spec here. |
| 98 for (size_t i = 0; i < languages.size(); ++i) { | 98 for (size_t i = 0; i < languages.size(); ++i) { |
| 99 String& token = languages[i]; | 99 String& token = languages[i]; |
| 100 token = token.stripWhiteSpace(); | 100 token = token.stripWhiteSpace(); |
| 101 if (token.length() >= 3 && token[2] == '_') | 101 if (token.length() >= 3 && token[2] == '_') |
| 102 token.replace(2, 1, "-"); | 102 token.replace(2, 1, "-"); |
| 103 } | 103 } |
| 104 | 104 |
| 105 return languages; | 105 return languages; |
| 106 } | 106 } |
| 107 | 107 |
| 108 DEFINE_TRACE(Navigator) | 108 DEFINE_TRACE(Navigator) |
| 109 { | 109 { |
| 110 DOMWindowProperty::trace(visitor); | 110 DOMWindowProperty::trace(visitor); |
| 111 Supplementable<Navigator>::trace(visitor); | 111 Supplementable<Navigator>::trace(visitor); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |