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 30 matching lines...) Expand all Loading... |
41 #include "core/page/DOMWindowPagePopup.h" | 41 #include "core/page/DOMWindowPagePopup.h" |
42 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
43 #include "core/page/FocusController.h" | 43 #include "core/page/FocusController.h" |
44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
45 #include "core/page/PagePopupClient.h" | 45 #include "core/page/PagePopupClient.h" |
46 #include "core/rendering/RenderView.h" | 46 #include "core/rendering/RenderView.h" |
47 #include "modules/accessibility/AXObject.h" | 47 #include "modules/accessibility/AXObject.h" |
48 #include "modules/accessibility/AXObjectCacheImpl.h" | 48 #include "modules/accessibility/AXObjectCacheImpl.h" |
49 #include "platform/EventDispatchForbiddenScope.h" | 49 #include "platform/EventDispatchForbiddenScope.h" |
50 #include "platform/LayoutTestSupport.h" | 50 #include "platform/LayoutTestSupport.h" |
| 51 #include "platform/ScriptForbiddenScope.h" |
51 #include "platform/TraceEvent.h" | 52 #include "platform/TraceEvent.h" |
52 #include "platform/heap/Handle.h" | 53 #include "platform/heap/Handle.h" |
53 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" | 54 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" |
54 #include "public/platform/WebCursorInfo.h" | 55 #include "public/platform/WebCursorInfo.h" |
55 #include "public/web/WebAXObject.h" | 56 #include "public/web/WebAXObject.h" |
56 #include "public/web/WebFrameClient.h" | 57 #include "public/web/WebFrameClient.h" |
57 #include "public/web/WebViewClient.h" | 58 #include "public/web/WebViewClient.h" |
58 #include "public/web/WebWidgetClient.h" | 59 #include "public/web/WebWidgetClient.h" |
59 #include "web/WebInputEventConversion.h" | 60 #include "web/WebInputEventConversion.h" |
60 #include "web/WebLocalFrameImpl.h" | 61 #include "web/WebLocalFrameImpl.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing
AXObjectCache()) | 254 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing
AXObjectCache()) |
254 cache->childrenChanged(&m_popupClient->ownerElement()); | 255 cache->childrenChanged(&m_popupClient->ownerElement()); |
255 | 256 |
256 ASSERT(frame->localDOMWindow()); | 257 ASSERT(frame->localDOMWindow()); |
257 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); | 258 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); |
258 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f
rame->document()->existingAXObjectCache()); | 259 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f
rame->document()->existingAXObjectCache()); |
259 | 260 |
260 RefPtr<SharedBuffer> data = SharedBuffer::create(); | 261 RefPtr<SharedBuffer> data = SharedBuffer::create(); |
261 m_popupClient->writeDocument(data.get()); | 262 m_popupClient->writeDocument(data.get()); |
262 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t
ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); | 263 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t
ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); |
| 264 |
| 265 m_popupClient->didWriteDocument(frame->document()); |
| 266 |
263 return true; | 267 return true; |
264 } | 268 } |
265 | 269 |
| 270 void WebPagePopupImpl::postMessage(const String& message) |
| 271 { |
| 272 if (!m_page) |
| 273 return; |
| 274 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 275 LocalDOMWindow* window = toLocalFrame(m_page->mainFrame())->localDOMWindow()
; |
| 276 if (!window) |
| 277 return; |
| 278 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(message); |
| 279 window->dispatchEvent(event); |
| 280 } |
| 281 |
266 void WebPagePopupImpl::destroyPage() | 282 void WebPagePopupImpl::destroyPage() |
267 { | 283 { |
268 if (!m_page) | 284 if (!m_page) |
269 return; | 285 return; |
270 | 286 |
271 m_page->willBeDestroyed(); | 287 m_page->willBeDestroyed(); |
272 m_page.clear(); | 288 m_page.clear(); |
273 } | 289 } |
274 | 290 |
275 AXObject* WebPagePopupImpl::rootAXObject() | 291 AXObject* WebPagePopupImpl::rootAXObject() |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // A WebPagePopupImpl instance usually has two references. | 486 // A WebPagePopupImpl instance usually has two references. |
471 // - One owned by the instance itself. It represents the visible widget. | 487 // - One owned by the instance itself. It represents the visible widget. |
472 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 488 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
473 // WebPagePopupImpl to close. | 489 // WebPagePopupImpl to close. |
474 // We need them because the closing operation is asynchronous and the widget | 490 // We need them because the closing operation is asynchronous and the widget |
475 // can be closed while the WebViewImpl is unaware of it. | 491 // can be closed while the WebViewImpl is unaware of it. |
476 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 492 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
477 } | 493 } |
478 | 494 |
479 } // namespace blink | 495 } // namespace blink |
OLD | NEW |