| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "public/web/WebViewClient.h" | 59 #include "public/web/WebViewClient.h" |
| 60 #include "public/web/WebWidgetClient.h" | 60 #include "public/web/WebWidgetClient.h" |
| 61 #include "web/WebInputEventConversion.h" | 61 #include "web/WebInputEventConversion.h" |
| 62 #include "web/WebLocalFrameImpl.h" | 62 #include "web/WebLocalFrameImpl.h" |
| 63 #include "web/WebSettingsImpl.h" | 63 #include "web/WebSettingsImpl.h" |
| 64 #include "web/WebViewImpl.h" | 64 #include "web/WebViewImpl.h" |
| 65 | 65 |
| 66 namespace blink { | 66 namespace blink { |
| 67 | 67 |
| 68 class PagePopupChromeClient final : public EmptyChromeClient { | 68 class PagePopupChromeClient final : public EmptyChromeClient { |
| 69 WTF_MAKE_NONCOPYABLE(PagePopupChromeClient); | |
| 70 WTF_MAKE_FAST_ALLOCATED(PagePopupChromeClient); | |
| 71 | |
| 72 public: | 69 public: |
| 73 explicit PagePopupChromeClient(WebPagePopupImpl* popup) | 70 static PassOwnPtrWillBeRawPtr<PagePopupChromeClient> create(WebPagePopupImpl
* popup) |
| 74 : m_popup(popup) | |
| 75 { | 71 { |
| 76 ASSERT(m_popup->widgetClient()); | 72 return adoptPtrWillBeNoop(new PagePopupChromeClient(popup)); |
| 77 } | 73 } |
| 78 | 74 |
| 79 void setWindowRect(const IntRect& rect) override | 75 void setWindowRect(const IntRect& rect) override |
| 80 { | 76 { |
| 81 m_popup->m_windowRectInScreen = rect; | 77 m_popup->m_windowRectInScreen = rect; |
| 82 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen); | 78 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen); |
| 83 } | 79 } |
| 84 | 80 |
| 85 private: | 81 private: |
| 82 explicit PagePopupChromeClient(WebPagePopupImpl* popup) |
| 83 : m_popup(popup) |
| 84 { |
| 85 ASSERT(m_popup->widgetClient()); |
| 86 } |
| 87 |
| 86 void closeWindowSoon() override | 88 void closeWindowSoon() override |
| 87 { | 89 { |
| 88 m_popup->closePopup(); | 90 m_popup->closePopup(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 IntRect windowRect() override | 93 IntRect windowRect() override |
| 92 { | 94 { |
| 93 return IntRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectInS
creen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.heig
ht); | 95 return IntRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectInS
creen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.heig
ht); |
| 94 } | 96 } |
| 95 | 97 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 m_widgetClient->show(WebNavigationPolicy()); | 224 m_widgetClient->show(WebNavigationPolicy()); |
| 223 setFocus(true); | 225 setFocus(true); |
| 224 | 226 |
| 225 return true; | 227 return true; |
| 226 } | 228 } |
| 227 | 229 |
| 228 bool WebPagePopupImpl::initializePage() | 230 bool WebPagePopupImpl::initializePage() |
| 229 { | 231 { |
| 230 Page::PageClients pageClients; | 232 Page::PageClients pageClients; |
| 231 fillWithEmptyClients(pageClients); | 233 fillWithEmptyClients(pageClients); |
| 232 m_chromeClient = adoptPtr(new PagePopupChromeClient(this)); | 234 m_chromeClient = PagePopupChromeClient::create(this); |
| 233 pageClients.chromeClient = m_chromeClient.get(); | 235 pageClients.chromeClient = m_chromeClient.get(); |
| 234 | 236 |
| 235 m_page = adoptPtrWillBeNoop(new Page(pageClients)); | 237 m_page = adoptPtrWillBeNoop(new Page(pageClients)); |
| 236 m_page->settings().setScriptEnabled(true); | 238 m_page->settings().setScriptEnabled(true); |
| 237 m_page->settings().setAllowScriptsToCloseWindows(true); | 239 m_page->settings().setAllowScriptsToCloseWindows(true); |
| 238 m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); | 240 m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); |
| 239 m_page->settings().setDeviceSupportsTouch(m_webView->page()->settings().devi
ceSupportsTouch()); | 241 m_page->settings().setDeviceSupportsTouch(m_webView->page()->settings().devi
ceSupportsTouch()); |
| 240 // FIXME: Should we support enabling a11y while a popup is shown? | 242 // FIXME: Should we support enabling a11y while a popup is shown? |
| 241 m_page->settings().setAccessibilityEnabled(m_webView->page()->settings().acc
essibilityEnabled()); | 243 m_page->settings().setAccessibilityEnabled(m_webView->page()->settings().acc
essibilityEnabled()); |
| 242 m_page->settings().setScrollAnimatorEnabled(m_webView->page()->settings().sc
rollAnimatorEnabled()); | 244 m_page->settings().setScrollAnimatorEnabled(m_webView->page()->settings().sc
rollAnimatorEnabled()); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // A WebPagePopupImpl instance usually has two references. | 517 // A WebPagePopupImpl instance usually has two references. |
| 516 // - One owned by the instance itself. It represents the visible widget. | 518 // - One owned by the instance itself. It represents the visible widget. |
| 517 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 519 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 518 // WebPagePopupImpl to close. | 520 // WebPagePopupImpl to close. |
| 519 // We need them because the closing operation is asynchronous and the widget | 521 // We need them because the closing operation is asynchronous and the widget |
| 520 // can be closed while the WebViewImpl is unaware of it. | 522 // can be closed while the WebViewImpl is unaware of it. |
| 521 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 523 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 522 } | 524 } |
| 523 | 525 |
| 524 } // namespace blink | 526 } // namespace blink |
| OLD | NEW |