Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1836973003: Move download messages from Renderer to Frame filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RenderViewHostTest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3589 } 3589 }
3590 3590
3591 HitTestResult WebViewImpl::coreHitTestResultAt(const WebPoint& pointInViewport) 3591 HitTestResult WebViewImpl::coreHitTestResultAt(const WebPoint& pointInViewport)
3592 { 3592 {
3593 DocumentLifecycle::AllowThrottlingScope throttlingScope(mainFrameImpl()->fra me()->document()->lifecycle()); 3593 DocumentLifecycle::AllowThrottlingScope throttlingScope(mainFrameImpl()->fra me()->document()->lifecycle());
3594 FrameView* view = mainFrameImpl()->frameView(); 3594 FrameView* view = mainFrameImpl()->frameView();
3595 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p ointInViewport)); 3595 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p ointInViewport));
3596 return hitTestResultForRootFramePos(pointInRootFrame); 3596 return hitTestResultForRootFramePos(pointInRootFrame);
3597 } 3597 }
3598 3598
3599 void WebViewImpl::copyImageAt(const WebPoint& point)
3600 {
3601 if (!m_page)
3602 return;
3603
3604 HitTestResult result = hitTestResultForViewportPos(point);
3605 if (!isHTMLCanvasElement(result.innerNodeOrImageMapImage()) && result.absolu teImageURL().isEmpty()) {
3606 // There isn't actually an image at these coordinates. Might be because
3607 // the window scrolled while the context menu was open or because the pa ge
3608 // changed itself between when we thought there was an image here and wh en
3609 // we actually tried to retreive the image.
3610 //
3611 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving
3612 // to do two hit tests.
3613 return;
3614 }
3615
3616 m_page->deprecatedLocalMainFrame()->editor().copyImage(result);
3617 }
3618
3619 void WebViewImpl::saveImageAt(const WebPoint& point)
3620 {
3621 if (!m_client)
3622 return;
3623
3624 Node* node = hitTestResultForViewportPos(point).innerNodeOrImageMapImage();
3625 if (!node || !(isHTMLCanvasElement(*node) || isHTMLImageElement(*node)))
3626 return;
3627
3628 String url = toElement(*node).imageSourceURL();
3629 if (!KURL(KURL(), url).protocolIsData())
3630 return;
3631
3632 m_client->saveImageFromDataURL(url);
3633 }
3634
3635 void WebViewImpl::dragSourceEndedAt( 3599 void WebViewImpl::dragSourceEndedAt(
3636 const WebPoint& clientPoint, 3600 const WebPoint& clientPoint,
3637 const WebPoint& screenPoint, 3601 const WebPoint& screenPoint,
3638 WebDragOperation operation) 3602 WebDragOperation operation)
3639 { 3603 {
3640 PlatformMouseEvent pme(clientPoint, screenPoint, LeftButton, PlatformEvent:: MouseMoved, 3604 PlatformMouseEvent pme(clientPoint, screenPoint, LeftButton, PlatformEvent:: MouseMoved,
3641 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab le, WTF::monotonicallyIncreasingTime()); 3605 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab le, WTF::monotonicallyIncreasingTime());
3642 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme, 3606 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme,
3643 static_cast<DragOperation>(operation)); 3607 static_cast<DragOperation>(operation));
3644 } 3608 }
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 { 4517 {
4554 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4518 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4555 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4519 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4556 if (!page()) 4520 if (!page())
4557 return 1; 4521 return 1;
4558 4522
4559 return page()->deviceScaleFactor(); 4523 return page()->deviceScaleFactor();
4560 } 4524 }
4561 4525
4562 } // namespace blink 4526 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698