OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 | 329 |
330 void WebViewImpl::setMainFrame(WebFrame* frame) | 330 void WebViewImpl::setMainFrame(WebFrame* frame) |
331 { | 331 { |
332 if (frame->isWebLocalFrame()) | 332 if (frame->isWebLocalFrame()) |
333 toWebLocalFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0,
nullAtom, nullAtom); | 333 toWebLocalFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0,
nullAtom, nullAtom); |
334 else | 334 else |
335 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0
, nullAtom); | 335 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0
, nullAtom); |
336 } | 336 } |
337 | 337 |
338 void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) | |
339 { | |
340 m_autofillClient = autofillClient; | |
341 } | |
342 | |
343 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred
entialManagerClient) | 338 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred
entialManagerClient) |
344 { | 339 { |
345 ASSERT(m_page); | 340 ASSERT(m_page); |
346 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre
dentialManagerClient)); | 341 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre
dentialManagerClient)); |
347 } | 342 } |
348 | 343 |
349 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) | 344 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) |
350 { | 345 { |
351 if (devToolsClient) | 346 if (devToolsClient) |
352 m_devToolsAgent = adoptPtr(new WebDevToolsAgentImpl(this, devToolsClient
)); | 347 m_devToolsAgent = adoptPtr(new WebDevToolsAgentImpl(this, devToolsClient
)); |
353 else | 348 else |
354 m_devToolsAgent.clear(); | 349 m_devToolsAgent.clear(); |
355 } | 350 } |
356 | 351 |
357 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) | 352 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) |
358 { | 353 { |
359 ASSERT(m_page); | 354 ASSERT(m_page); |
360 providePrerendererClientTo(*m_page, new PrerendererClientImpl(prerendererCli
ent)); | 355 providePrerendererClientTo(*m_page, new PrerendererClientImpl(prerendererCli
ent)); |
361 } | 356 } |
362 | 357 |
363 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient) | 358 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient) |
364 { | 359 { |
365 m_spellCheckClient = spellCheckClient; | 360 m_spellCheckClient = spellCheckClient; |
366 } | 361 } |
367 | 362 |
368 WebViewImpl::WebViewImpl(WebViewClient* client) | 363 WebViewImpl::WebViewImpl(WebViewClient* client) |
369 : m_client(client) | 364 : m_client(client) |
370 , m_autofillClient(0) | |
371 , m_spellCheckClient(0) | 365 , m_spellCheckClient(0) |
372 , m_chromeClientImpl(this) | 366 , m_chromeClientImpl(this) |
373 , m_contextMenuClientImpl(this) | 367 , m_contextMenuClientImpl(this) |
374 , m_dragClientImpl(this) | 368 , m_dragClientImpl(this) |
375 , m_editorClientImpl(this) | 369 , m_editorClientImpl(this) |
376 , m_inspectorClientImpl(this) | 370 , m_inspectorClientImpl(this) |
377 , m_spellCheckerClientImpl(this) | 371 , m_spellCheckerClientImpl(this) |
378 , m_storageClientImpl(this) | 372 , m_storageClientImpl(this) |
379 , m_shouldAutoResize(false) | 373 , m_shouldAutoResize(false) |
380 , m_zoomLevel(0) | 374 , m_zoomLevel(0) |
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 return EventTypeNames::touchend; | 2025 return EventTypeNames::touchend; |
2032 case WebInputEvent::TouchCancel: | 2026 case WebInputEvent::TouchCancel: |
2033 return EventTypeNames::touchcancel; | 2027 return EventTypeNames::touchcancel; |
2034 default: | 2028 default: |
2035 return String("unknown"); | 2029 return String("unknown"); |
2036 } | 2030 } |
2037 } | 2031 } |
2038 | 2032 |
2039 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) | 2033 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) |
2040 { | 2034 { |
2041 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); | 2035 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof
illClient() : 0; |
| 2036 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); |
2042 // On the first input event since page load, |notifier| instructs the | 2037 // On the first input event since page load, |notifier| instructs the |
2043 // autofill client to unblock values of password input fields of any forms | 2038 // autofill client to unblock values of password input fields of any forms |
2044 // on the page. There is a single input event, GestureTap, which can both | 2039 // on the page. There is a single input event, GestureTap, which can both |
2045 // be the first event after page load, and cause a form submission. In that | 2040 // be the first event after page load, and cause a form submission. In that |
2046 // case, the form submission happens before the autofill client is told | 2041 // case, the form submission happens before the autofill client is told |
2047 // to unblock the password values, and so the password values are not | 2042 // to unblock the password values, and so the password values are not |
2048 // submitted. To avoid that, GestureTap is handled explicitly: | 2043 // submitted. To avoid that, GestureTap is handled explicitly: |
2049 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) { | 2044 if (inputEvent.type == WebInputEvent::GestureTap && autofillClient) { |
2050 m_userGestureObserved = true; | 2045 m_userGestureObserved = true; |
2051 m_autofillClient->firstUserGestureObserved(); | 2046 autofillClient->firstUserGestureObserved(); |
2052 } | 2047 } |
2053 | 2048 |
2054 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa
me(inputEvent.type).ascii()); | 2049 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa
me(inputEvent.type).ascii()); |
2055 // If we've started a drag and drop operation, ignore input events until | 2050 // If we've started a drag and drop operation, ignore input events until |
2056 // we're done. | 2051 // we're done. |
2057 if (m_doingDragAndDrop) | 2052 if (m_doingDragAndDrop) |
2058 return true; | 2053 return true; |
2059 | 2054 |
2060 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input
Event)) | 2055 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input
Event)) |
2061 return true; | 2056 return true; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 | 2155 |
2161 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() | 2156 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() |
2162 ? m_page->deprecatedLocalMainFrame() : 0; | 2157 ? m_page->deprecatedLocalMainFrame() : 0; |
2163 if (!frame) | 2158 if (!frame) |
2164 return; | 2159 return; |
2165 | 2160 |
2166 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); | 2161 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); |
2167 if (focusedFrame && focusedFrame->isLocalFrame()) { | 2162 if (focusedFrame && focusedFrame->isLocalFrame()) { |
2168 // Finish an ongoing composition to delete the composition node. | 2163 // Finish an ongoing composition to delete the composition node. |
2169 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom
position()) { | 2164 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom
position()) { |
2170 if (m_autofillClient) | 2165 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(toLoc
alFrame(focusedFrame.get())); |
2171 m_autofillClient->setIgnoreTextChanges(true); | 2166 if (webframe->autofillClient()) |
| 2167 webframe->autofillClient()->setIgnoreTextChanges(true); |
2172 | 2168 |
2173 toLocalFrame(focusedFrame.get())->inputMethodController().confir
mComposition(); | 2169 toLocalFrame(focusedFrame.get())->inputMethodController().confir
mComposition(); |
2174 | 2170 |
2175 if (m_autofillClient) | 2171 if (webframe->autofillClient()) |
2176 m_autofillClient->setIgnoreTextChanges(false); | 2172 webframe->autofillClient()->setIgnoreTextChanges(false); |
2177 } | 2173 } |
2178 m_imeAcceptEvents = false; | 2174 m_imeAcceptEvents = false; |
2179 } | 2175 } |
2180 } | 2176 } |
2181 } | 2177 } |
2182 | 2178 |
2183 bool WebViewImpl::setComposition( | 2179 bool WebViewImpl::setComposition( |
2184 const WebString& text, | 2180 const WebString& text, |
2185 const WebVector<WebCompositionUnderline>& underlines, | 2181 const WebVector<WebCompositionUnderline>& underlines, |
2186 int selectionStart, | 2182 int selectionStart, |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 m_dragOperation = WebDragOperationNone; | 3544 m_dragOperation = WebDragOperationNone; |
3549 m_currentDragData = nullptr; | 3545 m_currentDragData = nullptr; |
3550 } | 3546 } |
3551 | 3547 |
3552 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, | 3548 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, |
3553 const WebPoint& screenPoint, | 3549 const WebPoint& screenPoint, |
3554 int keyModifiers) | 3550 int keyModifiers) |
3555 { | 3551 { |
3556 ASSERT(m_currentDragData); | 3552 ASSERT(m_currentDragData); |
3557 | 3553 |
3558 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); | 3554 UserGestureNotifier notifier(mainFrameImpl() ? mainFrameImpl()->autofillClie
nt() : 0, &m_userGestureObserved); |
3559 | 3555 |
3560 // If this webview transitions from the "drop accepting" state to the "not | 3556 // If this webview transitions from the "drop accepting" state to the "not |
3561 // accepting" state, then our IPC message reply indicating that may be in- | 3557 // accepting" state, then our IPC message reply indicating that may be in- |
3562 // flight, or else delayed by javascript processing in this webview. If a | 3558 // flight, or else delayed by javascript processing in this webview. If a |
3563 // drop happens before our IPC reply has reached the browser process, then | 3559 // drop happens before our IPC reply has reached the browser process, then |
3564 // the browser forwards the drop to this webview. So only allow a drop to | 3560 // the browser forwards the drop to this webview. So only allow a drop to |
3565 // proceed if our webview m_dragOperation state is not DragOperationNone. | 3561 // proceed if our webview m_dragOperation state is not DragOperationNone. |
3566 | 3562 |
3567 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not
allow this drop. | 3563 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not
allow this drop. |
3568 dragTargetDragLeave(); | 3564 dragTargetDragLeave(); |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4500 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4496 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4501 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4497 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4502 } | 4498 } |
4503 | 4499 |
4504 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4500 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4505 { | 4501 { |
4506 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4502 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4507 } | 4503 } |
4508 | 4504 |
4509 } // namespace blink | 4505 } // namespace blink |
OLD | NEW |