| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/frame/FrameHost.h" | 32 #include "core/frame/FrameHost.h" |
| 33 | 33 |
| 34 #include "core/frame/EventHandlerRegistry.h" | 34 #include "core/frame/EventHandlerRegistry.h" |
| 35 #include "core/frame/TopControls.h" |
| 35 #include "core/inspector/ConsoleMessageStorage.h" | 36 #include "core/inspector/ConsoleMessageStorage.h" |
| 36 #include "core/inspector/InspectorController.h" | 37 #include "core/inspector/InspectorController.h" |
| 37 #include "core/page/Chrome.h" | 38 #include "core/page/Chrome.h" |
| 38 #include "core/page/ChromeClient.h" | 39 #include "core/page/ChromeClient.h" |
| 39 #include "core/page/Page.h" | 40 #include "core/page/Page.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 PassOwnPtrWillBeRawPtr<FrameHost> FrameHost::create(Page& page) | 44 PassOwnPtrWillBeRawPtr<FrameHost> FrameHost::create(Page& page) |
| 44 { | 45 { |
| 45 return adoptPtrWillBeNoop(new FrameHost(page)); | 46 return adoptPtrWillBeNoop(new FrameHost(page)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 FrameHost::FrameHost(Page& page) | 49 FrameHost::FrameHost(Page& page) |
| 49 : m_page(&page) | 50 : m_page(&page) |
| 51 , m_topControls(TopControls::create(*this)) |
| 50 , m_pinchViewport(PinchViewport::create(*this)) | 52 , m_pinchViewport(PinchViewport::create(*this)) |
| 51 , m_eventHandlerRegistry(adoptPtrWillBeNoop(new EventHandlerRegistry(*this))
) | 53 , m_eventHandlerRegistry(adoptPtrWillBeNoop(new EventHandlerRegistry(*this))
) |
| 52 , m_consoleMessageStorage(ConsoleMessageStorage::create()) | 54 , m_consoleMessageStorage(ConsoleMessageStorage::create()) |
| 53 , m_subframeCount(0) | 55 , m_subframeCount(0) |
| 54 { | 56 { |
| 55 } | 57 } |
| 56 | 58 |
| 57 // Explicitly in the .cpp to avoid default constructor in .h | 59 // Explicitly in the .cpp to avoid default constructor in .h |
| 58 FrameHost::~FrameHost() | 60 FrameHost::~FrameHost() |
| 59 { | 61 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 InstrumentingAgents* FrameHost::instrumentingAgents() const | 79 InstrumentingAgents* FrameHost::instrumentingAgents() const |
| 78 { | 80 { |
| 79 return m_page->inspectorController().instrumentingAgents(); | 81 return m_page->inspectorController().instrumentingAgents(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 float FrameHost::deviceScaleFactor() const | 84 float FrameHost::deviceScaleFactor() const |
| 83 { | 85 { |
| 84 return m_page->deviceScaleFactor(); | 86 return m_page->deviceScaleFactor(); |
| 85 } | 87 } |
| 86 | 88 |
| 89 TopControls& FrameHost::topControls() const |
| 90 { |
| 91 return *m_topControls; |
| 92 } |
| 93 |
| 87 PinchViewport& FrameHost::pinchViewport() const | 94 PinchViewport& FrameHost::pinchViewport() const |
| 88 { | 95 { |
| 89 return *m_pinchViewport; | 96 return *m_pinchViewport; |
| 90 } | 97 } |
| 91 | 98 |
| 92 EventHandlerRegistry& FrameHost::eventHandlerRegistry() const | 99 EventHandlerRegistry& FrameHost::eventHandlerRegistry() const |
| 93 { | 100 { |
| 94 return *m_eventHandlerRegistry; | 101 return *m_eventHandlerRegistry; |
| 95 } | 102 } |
| 96 | 103 |
| 97 ConsoleMessageStorage& FrameHost::consoleMessageStorage() const | 104 ConsoleMessageStorage& FrameHost::consoleMessageStorage() const |
| 98 { | 105 { |
| 99 return *m_consoleMessageStorage; | 106 return *m_consoleMessageStorage; |
| 100 } | 107 } |
| 101 | 108 |
| 102 void FrameHost::trace(Visitor* visitor) | 109 void FrameHost::trace(Visitor* visitor) |
| 103 { | 110 { |
| 104 visitor->trace(m_page); | 111 visitor->trace(m_page); |
| 112 visitor->trace(m_topControls); |
| 105 visitor->trace(m_pinchViewport); | 113 visitor->trace(m_pinchViewport); |
| 106 visitor->trace(m_eventHandlerRegistry); | 114 visitor->trace(m_eventHandlerRegistry); |
| 107 visitor->trace(m_consoleMessageStorage); | 115 visitor->trace(m_consoleMessageStorage); |
| 108 } | 116 } |
| 109 | 117 |
| 110 #if ENABLE(ASSERT) | 118 #if ENABLE(ASSERT) |
| 111 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) | 119 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) |
| 112 { | 120 { |
| 113 ASSERT(expectedFrameCount >= 0); | 121 ASSERT(expectedFrameCount >= 0); |
| 114 | 122 |
| 115 int actualFrameCount = 0; | 123 int actualFrameCount = 0; |
| 116 for (; frame; frame = frame->tree().traverseNext()) | 124 for (; frame; frame = frame->tree().traverseNext()) |
| 117 ++actualFrameCount; | 125 ++actualFrameCount; |
| 118 | 126 |
| 119 ASSERT(expectedFrameCount == actualFrameCount); | 127 ASSERT(expectedFrameCount == actualFrameCount); |
| 120 } | 128 } |
| 121 #endif | 129 #endif |
| 122 | 130 |
| 123 int FrameHost::subframeCount() const | 131 int FrameHost::subframeCount() const |
| 124 { | 132 { |
| 125 #if ENABLE(ASSERT) | 133 #if ENABLE(ASSERT) |
| 126 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); | 134 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); |
| 127 #endif | 135 #endif |
| 128 return m_subframeCount; | 136 return m_subframeCount; |
| 129 } | 137 } |
| 130 | 138 |
| 131 } | 139 } |
| OLD | NEW |