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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 { | 172 { |
172 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame()); | 173 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame()); |
173 if (obj && frame && frame->client()) | 174 if (obj && frame && frame->client()) |
174 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification)); | 175 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification)); |
175 | 176 |
176 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above. | 177 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above. |
177 if (obj && m_popup->m_webView->client()) | 178 if (obj && m_popup->m_webView->client()) |
178 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification)); | 179 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification)); |
179 } | 180 } |
180 | 181 |
182 virtual void setToolTip(const String& tooltipText, TextDirection dir) overri de | |
183 { | |
184 if (m_popup->m_webView->client()) | |
185 m_popup->m_webView->client()->setToolTipText(tooltipText, toWebTextD irection(dir)); | |
186 } | |
187 | |
181 WebPagePopupImpl* m_popup; | 188 WebPagePopupImpl* m_popup; |
182 }; | 189 }; |
183 | 190 |
184 class PagePopupFeaturesClient : public ContextFeaturesClient { | 191 class PagePopupFeaturesClient : public ContextFeaturesClient { |
185 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de; | 192 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de; |
186 }; | 193 }; |
187 | 194 |
188 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue) | 195 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue) |
189 { | 196 { |
190 if (type == ContextFeatures::PagePopup) | 197 if (type == ContextFeatures::PagePopup) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) | 260 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) |
254 cache->childrenChanged(&m_popupClient->ownerElement()); | 261 cache->childrenChanged(&m_popupClient->ownerElement()); |
255 | 262 |
256 ASSERT(frame->localDOMWindow()); | 263 ASSERT(frame->localDOMWindow()); |
257 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); | 264 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); |
258 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); | 265 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); |
259 | 266 |
260 RefPtr<SharedBuffer> data = SharedBuffer::create(); | 267 RefPtr<SharedBuffer> data = SharedBuffer::create(); |
261 m_popupClient->writeDocument(data.get()); | 268 m_popupClient->writeDocument(data.get()); |
262 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); | 269 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); |
270 | |
271 m_popupClient->didWriteDocument(frame->document()); | |
272 | |
263 return true; | 273 return true; |
264 } | 274 } |
265 | 275 |
276 void WebPagePopupImpl::postMessage(const String& message) | |
277 { | |
278 if (!m_page) | |
279 return; | |
280 ScriptForbiddenScope::AllowUserAgentScript allowScript; | |
281 LocalDOMWindow* window = toLocalFrame(m_page->mainFrame())->localDOMWindow() ; | |
tkent
2014/12/16 05:42:39
nit:
if (LocalDOMWindow* window = toLocalFrame(m_
keishi
2014/12/16 12:21:03
Done.
| |
282 if (!window) | |
283 return; | |
284 window->dispatchEvent(MessageEvent::create(message)); | |
285 } | |
286 | |
266 void WebPagePopupImpl::destroyPage() | 287 void WebPagePopupImpl::destroyPage() |
267 { | 288 { |
268 if (!m_page) | 289 if (!m_page) |
269 return; | 290 return; |
270 | 291 |
271 m_page->willBeDestroyed(); | 292 m_page->willBeDestroyed(); |
272 m_page.clear(); | 293 m_page.clear(); |
273 } | 294 } |
274 | 295 |
275 AXObject* WebPagePopupImpl::rootAXObject() | 296 AXObject* WebPagePopupImpl::rootAXObject() |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 // A WebPagePopupImpl instance usually has two references. | 491 // A WebPagePopupImpl instance usually has two references. |
471 // - One owned by the instance itself. It represents the visible widget. | 492 // - 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 | 493 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
473 // WebPagePopupImpl to close. | 494 // WebPagePopupImpl to close. |
474 // We need them because the closing operation is asynchronous and the widget | 495 // We need them because the closing operation is asynchronous and the widget |
475 // can be closed while the WebViewImpl is unaware of it. | 496 // can be closed while the WebViewImpl is unaware of it. |
476 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 497 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
477 } | 498 } |
478 | 499 |
479 } // namespace blink | 500 } // namespace blink |
OLD | NEW |