Chromium Code Reviews| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 { | 482 { |
| 483 if (!m_page) | 483 if (!m_page) |
| 484 return; | 484 return; |
| 485 m_page->focusController().setFocused(enable); | 485 m_page->focusController().setFocused(enable); |
| 486 if (enable) | 486 if (enable) |
| 487 m_page->focusController().setActive(true); | 487 m_page->focusController().setActive(true); |
| 488 } | 488 } |
| 489 | 489 |
| 490 void WebPagePopupImpl::close() | 490 void WebPagePopupImpl::close() |
| 491 { | 491 { |
| 492 m_closing = true; | 492 cancel(); |
|
tkent
2016/03/25 07:30:44
Is it safe to call cancel() unconditionally?
In th
keishi
2016/03/25 07:57:46
Done.
| |
| 493 // In case closePopup() was not called. | |
| 494 if (m_page) { | |
| 495 destroyPage(); | |
| 496 m_popupClient->didClosePopup(); | |
| 497 m_webView->cleanupPagePopup(); | |
| 498 } | |
| 499 m_widgetClient = 0; | 493 m_widgetClient = 0; |
| 500 deref(); | 494 deref(); |
| 501 } | 495 } |
| 502 | 496 |
| 503 void WebPagePopupImpl::closePopup() | 497 void WebPagePopupImpl::closePopup() |
| 504 { | 498 { |
| 505 // This function can be called in EventDispatchForbiddenScope for the main | 499 // This function can be called in EventDispatchForbiddenScope for the main |
| 506 // document, and the following operations dispatch some events. It's safe | 500 // document, and the following operations dispatch some events. It's safe |
| 507 // because web authors can't listen the events. | 501 // because web authors can't listen the events. |
| 508 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; | 502 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 // A WebPagePopupImpl instance usually has two references. | 555 // A WebPagePopupImpl instance usually has two references. |
| 562 // - One owned by the instance itself. It represents the visible widget. | 556 // - One owned by the instance itself. It represents the visible widget. |
| 563 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 557 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 564 // WebPagePopupImpl to close. | 558 // WebPagePopupImpl to close. |
| 565 // We need them because the closing operation is asynchronous and the widget | 559 // We need them because the closing operation is asynchronous and the widget |
| 566 // can be closed while the WebViewImpl is unaware of it. | 560 // can be closed while the WebViewImpl is unaware of it. |
| 567 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 561 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 568 } | 562 } |
| 569 | 563 |
| 570 } // namespace blink | 564 } // namespace blink |
| OLD | NEW |