| 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 17 matching lines...) Expand all Loading... |
| 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/testing/DummyPageHolder.h" | 32 #include "core/testing/DummyPageHolder.h" |
| 33 | 33 |
| 34 #include "core/frame/LocalDOMWindow.h" | 34 #include "core/frame/LocalDOMWindow.h" |
| 35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/loader/EmptyClients.h" |
| 38 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 PassOwnPtr<DummyPageHolder> DummyPageHolder::create(const IntSize& initialViewSi
ze, Page::PageClients* pageClients) | 43 PassOwnPtr<DummyPageHolder> DummyPageHolder::create( |
| 43 { | 44 const IntSize& initialViewSize, |
| 44 return adoptPtr(new DummyPageHolder(initialViewSize, pageClients)); | 45 Page::PageClients* pageClients, |
| 46 PassOwnPtr<FrameLoaderClient> frameLoaderClient) { |
| 47 return adoptPtr(new DummyPageHolder(initialViewSize, pageClients, frameLoade
rClient)); |
| 45 } | 48 } |
| 46 | 49 |
| 47 DummyPageHolder::DummyPageHolder(const IntSize& initialViewSize, Page::PageClien
ts* pageClients) | 50 DummyPageHolder::DummyPageHolder( |
| 51 const IntSize& initialViewSize, |
| 52 Page::PageClients* pageClients, |
| 53 PassOwnPtr<FrameLoaderClient> frameLoaderClient) |
| 48 { | 54 { |
| 49 if (!pageClients) { | 55 if (!pageClients) { |
| 50 fillWithEmptyClients(m_pageClients); | 56 fillWithEmptyClients(m_pageClients); |
| 51 } else { | 57 } else { |
| 52 m_pageClients.chromeClient = pageClients->chromeClient; | 58 m_pageClients.chromeClient = pageClients->chromeClient; |
| 53 m_pageClients.contextMenuClient = pageClients->contextMenuClient; | 59 m_pageClients.contextMenuClient = pageClients->contextMenuClient; |
| 54 m_pageClients.editorClient = pageClients->editorClient; | 60 m_pageClients.editorClient = pageClients->editorClient; |
| 55 m_pageClients.dragClient = pageClients->dragClient; | 61 m_pageClients.dragClient = pageClients->dragClient; |
| 56 m_pageClients.inspectorClient = pageClients->inspectorClient; | 62 m_pageClients.inspectorClient = pageClients->inspectorClient; |
| 57 m_pageClients.backForwardClient = pageClients->backForwardClient; | 63 m_pageClients.backForwardClient = pageClients->backForwardClient; |
| 58 m_pageClients.spellCheckerClient = pageClients->spellCheckerClient; | 64 m_pageClients.spellCheckerClient = pageClients->spellCheckerClient; |
| 59 m_pageClients.storageClient = pageClients->storageClient; | 65 m_pageClients.storageClient = pageClients->storageClient; |
| 60 } | 66 } |
| 61 m_page = adoptPtrWillBeNoop(new Page(m_pageClients)); | 67 m_page = adoptPtrWillBeNoop(new Page(m_pageClients)); |
| 62 Settings& settings = m_page->settings(); | 68 Settings& settings = m_page->settings(); |
| 63 // FIXME: http://crbug.com/363843. This needs to find a better way to | 69 // FIXME: http://crbug.com/363843. This needs to find a better way to |
| 64 // not create graphics layers. | 70 // not create graphics layers. |
| 65 settings.setAcceleratedCompositingEnabled(false); | 71 settings.setAcceleratedCompositingEnabled(false); |
| 66 | 72 |
| 67 m_frame = LocalFrame::create(&m_frameLoaderClient, &m_page->frameHost(), 0); | 73 m_frameLoaderClient = frameLoaderClient; |
| 74 if (!m_frameLoaderClient) |
| 75 m_frameLoaderClient = adoptPtr(new EmptyFrameLoaderClient); |
| 76 |
| 77 m_frame = LocalFrame::create(m_frameLoaderClient.get(), &m_page->frameHost()
, 0); |
| 68 m_frame->setView(FrameView::create(m_frame.get(), initialViewSize)); | 78 m_frame->setView(FrameView::create(m_frame.get(), initialViewSize)); |
| 69 m_frame->init(); | 79 m_frame->init(); |
| 70 } | 80 } |
| 71 | 81 |
| 72 DummyPageHolder::~DummyPageHolder() | 82 DummyPageHolder::~DummyPageHolder() |
| 73 { | 83 { |
| 74 m_page->willBeDestroyed(); | 84 m_page->willBeDestroyed(); |
| 75 m_page.clear(); | 85 m_page.clear(); |
| 76 #if !ENABLE(OILPAN) | 86 #if !ENABLE(OILPAN) |
| 77 ASSERT(m_frame->hasOneRef()); | 87 ASSERT(m_frame->hasOneRef()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 93 { | 103 { |
| 94 return *m_frame->view(); | 104 return *m_frame->view(); |
| 95 } | 105 } |
| 96 | 106 |
| 97 Document& DummyPageHolder::document() const | 107 Document& DummyPageHolder::document() const |
| 98 { | 108 { |
| 99 return *m_frame->domWindow()->document(); | 109 return *m_frame->domWindow()->document(); |
| 100 } | 110 } |
| 101 | 111 |
| 102 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |