| 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; |
| 493 // In case closePopup() was not called. |
| 494 if (m_page) { |
| 495 destroyPage(); |
| 496 m_popupClient->didClosePopup(); |
| 497 m_webView->cleanupPagePopup(); |
| 498 } |
| 492 m_widgetClient = 0; | 499 m_widgetClient = 0; |
| 493 // In case closePopup() was not called. | |
| 494 if (m_page) | |
| 495 cancel(); | |
| 496 deref(); | 500 deref(); |
| 497 } | 501 } |
| 498 | 502 |
| 499 void WebPagePopupImpl::closePopup() | 503 void WebPagePopupImpl::closePopup() |
| 500 { | 504 { |
| 501 // This function can be called in EventDispatchForbiddenScope for the main | 505 // This function can be called in EventDispatchForbiddenScope for the main |
| 502 // document, and the following operations dispatch some events. It's safe | 506 // document, and the following operations dispatch some events. It's safe |
| 503 // because web authors can't listen the events. | 507 // because web authors can't listen the events. |
| 504 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; | 508 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; |
| 505 | 509 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // A WebPagePopupImpl instance usually has two references. | 561 // A WebPagePopupImpl instance usually has two references. |
| 558 // - One owned by the instance itself. It represents the visible widget. | 562 // - One owned by the instance itself. It represents the visible widget. |
| 559 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 563 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 560 // WebPagePopupImpl to close. | 564 // WebPagePopupImpl to close. |
| 561 // We need them because the closing operation is asynchronous and the widget | 565 // We need them because the closing operation is asynchronous and the widget |
| 562 // can be closed while the WebViewImpl is unaware of it. | 566 // can be closed while the WebViewImpl is unaware of it. |
| 563 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 567 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 564 } | 568 } |
| 565 | 569 |
| 566 } // namespace blink | 570 } // namespace blink |
| OLD | NEW |