OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ASSERT(webView); | 150 ASSERT(webView); |
151 m_webView = webView; | 151 m_webView = webView; |
152 | 152 |
153 return initializePage(pluginType, hostDocument); | 153 return initializePage(pluginType, hostDocument); |
154 } | 154 } |
155 | 155 |
156 void WebHelperPluginImpl::closeHelperPlugin() | 156 void WebHelperPluginImpl::closeHelperPlugin() |
157 { | 157 { |
158 if (m_page) { | 158 if (m_page) { |
159 m_page->clearPageGroup(); | 159 m_page->clearPageGroup(); |
160 m_page->mainFrame()->loader()->stopAllLoaders(); | 160 m_page->mainFrame()->loader().stopAllLoaders(); |
161 } | 161 } |
162 | 162 |
163 // We must destroy the page now in case the host page is being destroyed, in | 163 // We must destroy the page now in case the host page is being destroyed, in |
164 // which case some of the objects the page depends on may have been | 164 // which case some of the objects the page depends on may have been |
165 // destroyed by the time this->close() is called asynchronously. | 165 // destroyed by the time this->close() is called asynchronously. |
166 destroyPage(); | 166 destroyPage(); |
167 | 167 |
168 // m_widgetClient might be 0 because this widget might be already closed. | 168 // m_widgetClient might be 0 because this widget might be already closed. |
169 if (m_widgetClient) { | 169 if (m_widgetClient) { |
170 // closeWidgetSoon() will call this->close() later. | 170 // closeWidgetSoon() will call this->close() later. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 m_page = adoptPtr(new Page(pageClients)); | 217 m_page = adoptPtr(new Page(pageClients)); |
218 ASSERT(!m_page->settings().isScriptEnabled()); | 218 ASSERT(!m_page->settings().isScriptEnabled()); |
219 m_page->settings().setPluginsEnabled(true); | 219 m_page->settings().setPluginsEnabled(true); |
220 | 220 |
221 m_webView->client()->initializeHelperPluginWebFrame(this); | 221 m_webView->client()->initializeHelperPluginWebFrame(this); |
222 | 222 |
223 // The page's main frame was set in initializeFrame() as a result of the abo
ve call. | 223 // The page's main frame was set in initializeFrame() as a result of the abo
ve call. |
224 Frame* frame = m_page->mainFrame(); | 224 Frame* frame = m_page->mainFrame(); |
225 ASSERT(frame); | 225 ASSERT(frame); |
226 frame->loader()->forceSandboxFlags(SandboxAll & ~SandboxPlugins); | 226 frame->loader().forceSandboxFlags(SandboxAll & ~SandboxPlugins); |
227 frame->setView(FrameView::create(frame)); | 227 frame->setView(FrameView::create(frame)); |
228 // No need to set a size or make it not transparent. | 228 // No need to set a size or make it not transparent. |
229 | 229 |
230 writeDocument(pluginType, hostDocument, frame->loader()->activeDocumentLoade
r()); | 230 writeDocument(pluginType, hostDocument, frame->loader().activeDocumentLoader
()); |
231 | 231 |
232 return true; | 232 return true; |
233 } | 233 } |
234 | 234 |
235 void WebHelperPluginImpl::destroyPage() | 235 void WebHelperPluginImpl::destroyPage() |
236 { | 236 { |
237 if (!m_page) | 237 if (!m_page) |
238 return; | 238 return; |
239 | 239 |
240 if (m_page->mainFrame()) | 240 if (m_page->mainFrame()) |
241 m_page->mainFrame()->loader()->frameDetached(); | 241 m_page->mainFrame()->loader().frameDetached(); |
242 | 242 |
243 m_page.clear(); | 243 m_page.clear(); |
244 } | 244 } |
245 | 245 |
246 void WebHelperPluginImpl::layout() | 246 void WebHelperPluginImpl::layout() |
247 { | 247 { |
248 PageWidgetDelegate::layout(m_page.get()); | 248 PageWidgetDelegate::layout(m_page.get()); |
249 } | 249 } |
250 | 250 |
251 void WebHelperPluginImpl::setFocus(bool) | 251 void WebHelperPluginImpl::setFocus(bool) |
(...skipping 16 matching lines...) Expand all Loading... |
268 // A WebHelperPluginImpl instance usually has two references. | 268 // A WebHelperPluginImpl instance usually has two references. |
269 // - One owned by the instance itself. It represents the visible widget. | 269 // - One owned by the instance itself. It represents the visible widget. |
270 // - One owned by the hosting element. It's released when the hosting | 270 // - One owned by the hosting element. It's released when the hosting |
271 // element asks the WebHelperPluginImpl to close. | 271 // element asks the WebHelperPluginImpl to close. |
272 // We need them because the closing operation is asynchronous and the widget | 272 // We need them because the closing operation is asynchronous and the widget |
273 // can be closed while the hosting element is unaware of it. | 273 // can be closed while the hosting element is unaware of it. |
274 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); | 274 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); |
275 } | 275 } |
276 | 276 |
277 } // namespace WebKit | 277 } // namespace WebKit |
OLD | NEW |