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 28 matching lines...) Expand all Loading... |
39 PluginData* data = GetPluginData(); | 39 PluginData* data = GetPluginData(); |
40 if (!data) | 40 if (!data) |
41 return 0; | 41 return 0; |
42 return data->Plugins().size(); | 42 return data->Plugins().size(); |
43 } | 43 } |
44 | 44 |
45 DOMPlugin* DOMPluginArray::item(unsigned index) { | 45 DOMPlugin* DOMPluginArray::item(unsigned index) { |
46 PluginData* data = GetPluginData(); | 46 PluginData* data = GetPluginData(); |
47 if (!data) | 47 if (!data) |
48 return nullptr; | 48 return nullptr; |
49 const Vector<PluginInfo>& plugins = data->Plugins(); | 49 const HeapVector<Member<PluginInfo>>& plugins = data->Plugins(); |
50 if (index >= plugins.size()) | 50 if (index >= plugins.size()) |
51 return nullptr; | 51 return nullptr; |
52 return DOMPlugin::Create(data, GetFrame(), index); | 52 return DOMPlugin::Create(GetFrame(), *plugins[index]); |
53 } | 53 } |
54 | 54 |
55 DOMPlugin* DOMPluginArray::namedItem(const AtomicString& property_name) { | 55 DOMPlugin* DOMPluginArray::namedItem(const AtomicString& property_name) { |
56 PluginData* data = GetPluginData(); | 56 PluginData* data = GetPluginData(); |
57 if (!data) | 57 if (!data) |
58 return nullptr; | 58 return nullptr; |
59 const Vector<PluginInfo>& plugins = data->Plugins(); | 59 for (const PluginInfo* plugin : data->Plugins()) { |
60 for (unsigned i = 0; i < plugins.size(); ++i) { | 60 if (plugin->Name() == property_name) |
61 if (plugins[i].name == property_name) | 61 return DOMPlugin::Create(GetFrame(), *plugin); |
62 return DOMPlugin::Create(data, GetFrame(), i); | |
63 } | 62 } |
64 return nullptr; | 63 return nullptr; |
65 } | 64 } |
66 | 65 |
67 void DOMPluginArray::refresh(bool reload) { | 66 void DOMPluginArray::refresh(bool reload) { |
68 if (!GetFrame()) | 67 if (!GetFrame()) |
69 return; | 68 return; |
70 Page::RefreshPlugins(); | 69 Page::RefreshPlugins(); |
71 if (reload) { | 70 if (reload) { |
72 GetFrame()->Reload(kFrameLoadTypeReload, | 71 GetFrame()->Reload(kFrameLoadTypeReload, |
73 ClientRedirectPolicy::kClientRedirect); | 72 ClientRedirectPolicy::kClientRedirect); |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 PluginData* DOMPluginArray::GetPluginData() const { | 76 PluginData* DOMPluginArray::GetPluginData() const { |
78 if (!GetFrame()) | 77 if (!GetFrame()) |
79 return nullptr; | 78 return nullptr; |
80 return GetFrame()->GetPluginData(); | 79 return GetFrame()->GetPluginData(); |
81 } | 80 } |
82 | 81 |
83 } // namespace blink | 82 } // namespace blink |
OLD | NEW |