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

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

Powered by Google App Engine
This is Rietveld 408576698