| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * Copyright (C) 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Lesser General Public | 6 * modify it under the terms of the GNU Lesser General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 PluginData* data = GetPluginData(); | 38 PluginData* data = GetPluginData(); |
| 39 if (!data) | 39 if (!data) |
| 40 return 0; | 40 return 0; |
| 41 return data->Mimes().size(); | 41 return data->Mimes().size(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 DOMMimeType* DOMMimeTypeArray::item(unsigned index) { | 44 DOMMimeType* DOMMimeTypeArray::item(unsigned index) { |
| 45 PluginData* data = GetPluginData(); | 45 PluginData* data = GetPluginData(); |
| 46 if (!data) | 46 if (!data) |
| 47 return nullptr; | 47 return nullptr; |
| 48 const Vector<MimeClassInfo>& mimes = data->Mimes(); | 48 const HeapVector<Member<MimeClassInfo>>& mimes = data->Mimes(); |
| 49 if (index >= mimes.size()) | 49 if (index >= mimes.size()) |
| 50 return nullptr; | 50 return nullptr; |
| 51 return DOMMimeType::Create(data, GetFrame(), index); | 51 return DOMMimeType::Create(GetFrame(), *mimes[index]); |
| 52 } | 52 } |
| 53 | 53 |
| 54 DOMMimeType* DOMMimeTypeArray::namedItem(const AtomicString& property_name) { | 54 DOMMimeType* DOMMimeTypeArray::namedItem(const AtomicString& property_name) { |
| 55 PluginData* data = GetPluginData(); | 55 PluginData* data = GetPluginData(); |
| 56 if (!data) | 56 if (!data) |
| 57 return nullptr; | 57 return nullptr; |
| 58 const Vector<MimeClassInfo>& mimes = data->Mimes(); | 58 for (const MimeClassInfo* mime : data->Mimes()) { |
| 59 for (unsigned i = 0; i < mimes.size(); ++i) { | 59 if (mime->Type() == property_name) |
| 60 if (mimes[i].type == property_name) | 60 return DOMMimeType::Create(GetFrame(), *mime); |
| 61 return DOMMimeType::Create(data, GetFrame(), i); | |
| 62 } | 61 } |
| 63 return nullptr; | 62 return nullptr; |
| 64 } | 63 } |
| 65 | 64 |
| 66 PluginData* DOMMimeTypeArray::GetPluginData() const { | 65 PluginData* DOMMimeTypeArray::GetPluginData() const { |
| 67 if (!GetFrame()) | 66 if (!GetFrame()) |
| 68 return nullptr; | 67 return nullptr; |
| 69 return GetFrame()->GetPluginData(); | 68 return GetFrame()->GetPluginData(); |
| 70 } | 69 } |
| 71 | 70 |
| 72 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |