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

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: merge boo boo 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 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 } 3618 }
3619 3619
3620 HitTestResult WebViewImpl::coreHitTestResultAt(const WebPoint& pointInViewport) 3620 HitTestResult WebViewImpl::coreHitTestResultAt(const WebPoint& pointInViewport)
3621 { 3621 {
3622 DocumentLifecycle::AllowThrottlingScope throttlingScope(mainFrameImpl()->fra me()->document()->lifecycle()); 3622 DocumentLifecycle::AllowThrottlingScope throttlingScope(mainFrameImpl()->fra me()->document()->lifecycle());
3623 FrameView* view = mainFrameImpl()->frameView(); 3623 FrameView* view = mainFrameImpl()->frameView();
3624 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p ointInViewport)); 3624 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p ointInViewport));
3625 return hitTestResultForRootFramePos(pointInRootFrame); 3625 return hitTestResultForRootFramePos(pointInRootFrame);
3626 } 3626 }
3627 3627
3628 void WebViewImpl::copyImageAt(const WebPoint& point)
3629 {
3630 if (!m_page)
3631 return;
3632
3633 HitTestResult result = hitTestResultForViewportPos(point);
3634 if (!isHTMLCanvasElement(result.innerNodeOrImageMapImage()) && result.absolu teImageURL().isEmpty()) {
3635 // There isn't actually an image at these coordinates. Might be because
3636 // the window scrolled while the context menu was open or because the pa ge
3637 // changed itself between when we thought there was an image here and wh en
3638 // we actually tried to retreive the image.
3639 //
3640 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving
3641 // to do two hit tests.
3642 return;
3643 }
3644
3645 m_page->deprecatedLocalMainFrame()->editor().copyImage(result);
3646 }
3647
3648 void WebViewImpl::saveImageAt(const WebPoint& point)
3649 {
3650 if (!m_client)
3651 return;
3652
3653 Node* node = hitTestResultForViewportPos(point).innerNodeOrImageMapImage();
3654 if (!node || !(isHTMLCanvasElement(*node) || isHTMLImageElement(*node)))
3655 return;
3656
3657 String url = toElement(*node).imageSourceURL();
3658 if (!KURL(KURL(), url).protocolIsData())
3659 return;
3660
3661 m_client->saveImageFromDataURL(url);
3662 }
3663
3664 void WebViewImpl::dragSourceEndedAt( 3628 void WebViewImpl::dragSourceEndedAt(
3665 const WebPoint& clientPoint, 3629 const WebPoint& clientPoint,
3666 const WebPoint& screenPoint, 3630 const WebPoint& screenPoint,
3667 WebDragOperation operation) 3631 WebDragOperation operation)
3668 { 3632 {
3669 PlatformMouseEvent pme(clientPoint, screenPoint, LeftButton, PlatformEvent:: MouseMoved, 3633 PlatformMouseEvent pme(clientPoint, screenPoint, LeftButton, PlatformEvent:: MouseMoved,
3670 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab le, WTF::monotonicallyIncreasingTime()); 3634 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab le, WTF::monotonicallyIncreasingTime());
3671 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme, 3635 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme,
3672 static_cast<DragOperation>(operation)); 3636 static_cast<DragOperation>(operation));
3673 } 3637 }
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
4566 { 4530 {
4567 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4531 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4568 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4532 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4569 if (!page()) 4533 if (!page())
4570 return 1; 4534 return 1;
4571 4535
4572 return page()->deviceScaleFactor(); 4536 return page()->deviceScaleFactor();
4573 } 4537 }
4574 4538
4575 } // namespace blink 4539 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698