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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 595713002: Move local frame-only methods out of WebFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 frameRequest.setLockBackForwardList(replace); 880 frameRequest.setLockBackForwardList(replace);
881 frame()->loader().load(frameRequest); 881 frame()->loader().load(frameRequest);
882 } 882 }
883 883
884 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace) 884 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace)
885 { 885 {
886 ASSERT(frame()); 886 ASSERT(frame());
887 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace); 887 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace);
888 } 888 }
889 889
890 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina tionURL)
891 {
892 ASSERT(frame());
893 const Node* node = linkNode.constUnwrap<Node>();
894 if (isHTMLAnchorElement(node))
895 toHTMLAnchorElement(node)->sendPings(destinationURL);
896 }
897
898 bool WebLocalFrameImpl::isLoading() const
899 {
900 if (!frame() || !frame()->document())
901 return false;
902 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || !frame()->document()->loadEventFinished();
903 }
904
905 bool WebLocalFrameImpl::isResourceLoadInProgress() const
906 {
907 if (!frame() || !frame()->document())
908 return false;
909 return frame()->document()->fetcher()->requestCount();
910 }
911
912 void WebLocalFrameImpl::stopLoading() 890 void WebLocalFrameImpl::stopLoading()
913 { 891 {
914 if (!frame()) 892 if (!frame())
915 return; 893 return;
916 // FIXME: Figure out what we should really do here. It seems like a bug 894 // FIXME: Figure out what we should really do here. It seems like a bug
917 // that FrameLoader::stopLoading doesn't call stopAllLoaders. 895 // that FrameLoader::stopLoading doesn't call stopAllLoaders.
918 frame()->loader().stopAllLoaders(); 896 frame()->loader().stopAllLoaders();
919 } 897 }
920 898
921 WebDataSource* WebLocalFrameImpl::provisionalDataSource() const 899 WebDataSource* WebLocalFrameImpl::provisionalDataSource() const
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1209
1232 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) 1210 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after)
1233 { 1211 {
1234 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) { 1212 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
1235 plugin->extendSelectionAndDelete(before, after); 1213 plugin->extendSelectionAndDelete(before, after);
1236 return; 1214 return;
1237 } 1215 }
1238 frame()->inputMethodController().extendSelectionAndDelete(before, after); 1216 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1239 } 1217 }
1240 1218
1241 void WebLocalFrameImpl::navigateToSandboxedMarkup(const WebData& markup)
1242 {
1243 ASSERT(document().securityOrigin().isUnique());
1244 frame()->loader().forceSandboxFlags(SandboxAll);
1245 loadHTMLString(markup, document().url(), WebURL(), true);
1246 }
1247
1248 void WebLocalFrameImpl::setCaretVisible(bool visible) 1219 void WebLocalFrameImpl::setCaretVisible(bool visible)
1249 { 1220 {
1250 frame()->selection().setCaretVisible(visible); 1221 frame()->selection().setCaretVisible(visible);
1251 } 1222 }
1252 1223
1253 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) 1224 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
1254 { 1225 {
1255 // FIXME(bokan): crbug.com/371902 - These scale/pinch transforms shouldn't 1226 // FIXME(bokan): crbug.com/371902 - These scale/pinch transforms shouldn't
1256 // be ad hoc and explicit. 1227 // be ad hoc and explicit.
1257 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 1228 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 // This function should only be called on the mainframe. 1374 // This function should only be called on the mainframe.
1404 ASSERT(!parent()); 1375 ASSERT(!parent());
1405 ensureTextFinder().increaseMatchCount(identifier, count); 1376 ensureTextFinder().increaseMatchCount(identifier, count);
1406 } 1377 }
1407 1378
1408 void WebLocalFrameImpl::resetMatchCount() 1379 void WebLocalFrameImpl::resetMatchCount()
1409 { 1380 {
1410 ensureTextFinder().resetMatchCount(); 1381 ensureTextFinder().resetMatchCount();
1411 } 1382 }
1412 1383
1413 void WebLocalFrameImpl::sendOrientationChangeEvent()
1414 {
1415 if (!frame())
1416 return;
1417
1418 // Screen Orientation API
1419 if (ScreenOrientationController::from(*frame()))
1420 ScreenOrientationController::from(*frame())->notifyOrientationChanged();
1421
1422 // Legacy window.orientation API.
1423 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( ))
1424 frame()->domWindow()->dispatchEvent(Event::create(EventTypeNames::orient ationchange));
1425 }
1426
1427 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event) 1384 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event)
1428 { 1385 {
1429 ASSERT(!event.isNull()); 1386 ASSERT(!event.isNull());
1430 frame()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrig in.get(), event, nullptr); 1387 frame()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrig in.get(), event, nullptr);
1431 } 1388 }
1432 1389
1433 int WebLocalFrameImpl::findMatchMarkersVersion() const 1390 int WebLocalFrameImpl::findMatchMarkersVersion() const
1434 { 1391 {
1435 ASSERT(!parent()); 1392 ASSERT(!parent());
1436 1393
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 { 1813 {
1857 RefPtrWillBeRawPtr<Element> styleElement = frame()->document()->createElemen t(HTMLNames::linkTag, false); 1814 RefPtrWillBeRawPtr<Element> styleElement = frame()->document()->createElemen t(HTMLNames::linkTag, false);
1858 1815
1859 styleElement->setAttribute(HTMLNames::typeAttr, "text/css"); 1816 styleElement->setAttribute(HTMLNames::typeAttr, "text/css");
1860 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet"); 1817 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet");
1861 styleElement->setAttribute(HTMLNames::hrefAttr, url); 1818 styleElement->setAttribute(HTMLNames::hrefAttr, url);
1862 1819
1863 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION); 1820 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION);
1864 } 1821 }
1865 1822
1823 void WebLocalFrameImpl::navigateToSandboxedMarkup(const WebData& markup)
1824 {
1825 ASSERT(document().securityOrigin().isUnique());
1826 frame()->loader().forceSandboxFlags(SandboxAll);
1827 loadHTMLString(markup, document().url(), WebURL(), true);
1828 }
1829
1830 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina tionURL)
1831 {
1832 ASSERT(frame());
1833 const Node* node = linkNode.constUnwrap<Node>();
1834 if (isHTMLAnchorElement(node))
1835 toHTMLAnchorElement(node)->sendPings(destinationURL);
1836 }
1837
1838 bool WebLocalFrameImpl::isLoading() const
1839 {
1840 if (!frame() || !frame()->document())
1841 return false;
1842 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || !frame()->document()->loadEventFinished();
1843 }
1844
1845 bool WebLocalFrameImpl::isResourceLoadInProgress() const
1846 {
1847 if (!frame() || !frame()->document())
1848 return false;
1849 return frame()->document()->fetcher()->requestCount();
1850 }
1851
1852 void WebLocalFrameImpl::sendOrientationChangeEvent()
1853 {
1854 if (!frame())
1855 return;
1856
1857 // Screen Orientation API
1858 if (ScreenOrientationController::from(*frame()))
1859 ScreenOrientationController::from(*frame())->notifyOrientationChanged();
1860
1861 // Legacy window.orientation API.
1862 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( ))
1863 frame()->domWindow()->dispatchEvent(Event::create(EventTypeNames::orient ationchange));
1864 }
1865
1866 v8::Handle<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValueForTests(con st WebScriptSource& source)
1867 {
1868 // FIXME: This fake UserGestureIndicator is required for a bunch of browser
1869 // tests to pass. We should update the tests to simulate input and get rid
1870 // of this.
1871 // http://code.google.com/p/chromium/issues/detail?id=86397
1872 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
1873 return executeScriptAndReturnValue(source);
1874 }
1875
1866 void WebLocalFrameImpl::willDetachParent() 1876 void WebLocalFrameImpl::willDetachParent()
1867 { 1877 {
1868 // Do not expect string scoping results from any frames that got detached 1878 // Do not expect string scoping results from any frames that got detached
1869 // in the middle of the operation. 1879 // in the middle of the operation.
1870 if (m_textFinder && m_textFinder->scopingInProgress()) { 1880 if (m_textFinder && m_textFinder->scopingInProgress()) {
1871 1881
1872 // There is a possibility that the frame being detached was the only 1882 // There is a possibility that the frame being detached was the only
1873 // pending one. We need to make sure final replies can be sent. 1883 // pending one. We need to make sure final replies can be sent.
1874 m_textFinder->flushCurrentScoping(); 1884 m_textFinder->flushCurrentScoping();
1875 1885
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 1923
1914 void WebLocalFrameImpl::invalidateAll() const 1924 void WebLocalFrameImpl::invalidateAll() const
1915 { 1925 {
1916 ASSERT(frame() && frame()->view()); 1926 ASSERT(frame() && frame()->view());
1917 FrameView* view = frame()->view(); 1927 FrameView* view = frame()->view();
1918 view->invalidateRect(view->frameRect()); 1928 view->invalidateRect(view->frameRect());
1919 invalidateScrollbar(); 1929 invalidateScrollbar();
1920 } 1930 }
1921 1931
1922 } // namespace blink 1932 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698