Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: Source/web/WebPagePopupImpl.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 m_chromeClient = adoptPtr(new PagePopupChromeClient(this)); 190 m_chromeClient = adoptPtr(new PagePopupChromeClient(this));
191 pageClients.chromeClient = m_chromeClient.get(); 191 pageClients.chromeClient = m_chromeClient.get();
192 192
193 m_page = adoptPtr(new Page(pageClients)); 193 m_page = adoptPtr(new Page(pageClients));
194 m_page->settings().setScriptEnabled(true); 194 m_page->settings().setScriptEnabled(true);
195 m_page->settings().setAllowScriptsToCloseWindows(true); 195 m_page->settings().setAllowScriptsToCloseWindows(true);
196 m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); 196 m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor());
197 m_page->settings().setDeviceSupportsTouch(m_webView->page()->settings().devi ceSupportsTouch()); 197 m_page->settings().setDeviceSupportsTouch(m_webView->page()->settings().devi ceSupportsTouch());
198 198
199 static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeatur esClient(); 199 static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeatur esClient();
200 provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); 200 provideContextFeaturesTo(*m_page, pagePopupFeaturesClient);
201 static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClie nt(); 201 static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClie nt();
202 RefPtr<Frame> frame = Frame::create(FrameInit::create(0, &m_page->frameHost( ), emptyFrameLoaderClient)); 202 RefPtr<Frame> frame = Frame::create(FrameInit::create(0, &m_page->frameHost( ), emptyFrameLoaderClient));
203 frame->setView(FrameView::create(frame.get())); 203 frame->setView(FrameView::create(frame.get()));
204 frame->init(); 204 frame->init();
205 frame->view()->resize(m_popupClient->contentSize()); 205 frame->view()->resize(m_popupClient->contentSize());
206 frame->view()->setTransparent(false); 206 frame->view()->setTransparent(false);
207 207
208 DOMWindowPagePopup::install(frame->domWindow(), m_popupClient); 208 ASSERT(frame->domWindow());
209 DOMWindowPagePopup::install(*frame->domWindow(), m_popupClient);
209 210
210 RefPtr<SharedBuffer> data = SharedBuffer::create(); 211 RefPtr<SharedBuffer> data = SharedBuffer::create();
211 m_popupClient->writeDocument(data.get()); 212 m_popupClient->writeDocument(data.get());
212 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); 213 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad)));
213 return true; 214 return true;
214 } 215 }
215 216
216 void WebPagePopupImpl::destroyPage() 217 void WebPagePopupImpl::destroyPage()
217 { 218 {
218 if (!m_page) 219 if (!m_page)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 destroyPage(); // In case closePopup() was not called. 307 destroyPage(); // In case closePopup() was not called.
307 m_widgetClient = 0; 308 m_widgetClient = 0;
308 deref(); 309 deref();
309 } 310 }
310 311
311 void WebPagePopupImpl::closePopup() 312 void WebPagePopupImpl::closePopup()
312 { 313 {
313 if (m_page) { 314 if (m_page) {
314 m_page->clearPageGroup(); 315 m_page->clearPageGroup();
315 m_page->mainFrame()->loader().stopAllLoaders(); 316 m_page->mainFrame()->loader().stopAllLoaders();
316 DOMWindowPagePopup::uninstall(m_page->mainFrame()->domWindow()); 317 ASSERT(m_page->mainFrame()->domWindow());
318 DOMWindowPagePopup::uninstall(*m_page->mainFrame()->domWindow());
317 } 319 }
318 m_closing = true; 320 m_closing = true;
319 321
320 destroyPage(); 322 destroyPage();
321 323
322 // m_widgetClient might be 0 because this widget might be already closed. 324 // m_widgetClient might be 0 because this widget might be already closed.
323 if (m_widgetClient) { 325 if (m_widgetClient) {
324 // closeWidgetSoon() will call this->close() later. 326 // closeWidgetSoon() will call this->close() later.
325 m_widgetClient->closeWidgetSoon(); 327 m_widgetClient->closeWidgetSoon();
326 } 328 }
(...skipping 10 matching lines...) Expand all
337 // A WebPagePopupImpl instance usually has two references. 339 // A WebPagePopupImpl instance usually has two references.
338 // - One owned by the instance itself. It represents the visible widget. 340 // - One owned by the instance itself. It represents the visible widget.
339 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 341 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
340 // WebPagePopupImpl to close. 342 // WebPagePopupImpl to close.
341 // We need them because the closing operation is asynchronous and the widget 343 // We need them because the closing operation is asynchronous and the widget
342 // can be closed while the WebViewImpl is unaware of it. 344 // can be closed while the WebViewImpl is unaware of it.
343 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 345 return adoptRef(new WebPagePopupImpl(client)).leakRef();
344 } 346 }
345 347
346 } // namespace blink 348 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698