OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/plugins/NavigatorPlugins.h" | 6 #include "modules/plugins/NavigatorPlugins.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
11 #include "modules/plugins/DOMMimeTypeArray.h" | 11 #include "modules/plugins/DOMMimeTypeArray.h" |
12 #include "modules/plugins/DOMPluginArray.h" | 12 #include "modules/plugins/DOMPluginArray.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 NavigatorPlugins::NavigatorPlugins(Navigator& navigator) | 16 NavigatorPlugins::NavigatorPlugins(Navigator& navigator) |
17 : DOMWindowProperty(navigator.frame()) | 17 : DOMWindowProperty(navigator.frame()) |
18 { | 18 { |
19 } | 19 } |
20 | 20 |
21 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorPlugins); | 21 NavigatorPlugins::~NavigatorPlugins() |
| 22 { |
| 23 } |
22 | 24 |
23 // static | 25 // static |
24 NavigatorPlugins& NavigatorPlugins::from(Navigator& navigator) | 26 NavigatorPlugins& NavigatorPlugins::from(Navigator& navigator) |
25 { | 27 { |
26 NavigatorPlugins* supplement = toNavigatorPlugins(navigator); | 28 NavigatorPlugins* supplement = toNavigatorPlugins(navigator); |
27 if (!supplement) { | 29 if (!supplement) { |
28 supplement = new NavigatorPlugins(navigator); | 30 supplement = new NavigatorPlugins(navigator); |
29 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 31 provideTo(navigator, supplementName(), supplement); |
30 } | 32 } |
31 return *supplement; | 33 return *supplement; |
32 } | 34 } |
33 | 35 |
34 // static | 36 // static |
35 NavigatorPlugins* NavigatorPlugins::toNavigatorPlugins(Navigator& navigator) | 37 NavigatorPlugins* NavigatorPlugins::toNavigatorPlugins(Navigator& navigator) |
36 { | 38 { |
37 return static_cast<NavigatorPlugins*>(WillBeHeapSupplement<Navigator>::from(
navigator, supplementName())); | 39 return static_cast<NavigatorPlugins*>(HeapSupplement<Navigator>::from(naviga
tor, supplementName())); |
38 } | 40 } |
39 | 41 |
40 // static | 42 // static |
41 const char* NavigatorPlugins::supplementName() | 43 const char* NavigatorPlugins::supplementName() |
42 { | 44 { |
43 return "NavigatorPlugins"; | 45 return "NavigatorPlugins"; |
44 } | 46 } |
45 | 47 |
46 // static | 48 // static |
47 DOMPluginArray* NavigatorPlugins::plugins(Navigator& navigator) | 49 DOMPluginArray* NavigatorPlugins::plugins(Navigator& navigator) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (!frame || !frame->settings()) | 82 if (!frame || !frame->settings()) |
81 return false; | 83 return false; |
82 | 84 |
83 return frame->settings()->javaEnabled(); | 85 return frame->settings()->javaEnabled(); |
84 } | 86 } |
85 | 87 |
86 DEFINE_TRACE(NavigatorPlugins) | 88 DEFINE_TRACE(NavigatorPlugins) |
87 { | 89 { |
88 visitor->trace(m_plugins); | 90 visitor->trace(m_plugins); |
89 visitor->trace(m_mimeTypes); | 91 visitor->trace(m_mimeTypes); |
90 WillBeHeapSupplement<Navigator>::trace(visitor); | 92 HeapSupplement<Navigator>::trace(visitor); |
91 DOMWindowProperty::trace(visitor); | 93 DOMWindowProperty::trace(visitor); |
92 } | 94 } |
93 | 95 |
94 } // namespace blink | 96 } // namespace blink |
OLD | NEW |