Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 #include "platform/graphics/skia/SkiaUtils.h" | 170 #include "platform/graphics/skia/SkiaUtils.h" |
| 171 #include "platform/heap/Handle.h" | 171 #include "platform/heap/Handle.h" |
| 172 #include "platform/network/ResourceRequest.h" | 172 #include "platform/network/ResourceRequest.h" |
| 173 #include "platform/scroll/ScrollTypes.h" | 173 #include "platform/scroll/ScrollTypes.h" |
| 174 #include "platform/scroll/ScrollbarTheme.h" | 174 #include "platform/scroll/ScrollbarTheme.h" |
| 175 #include "platform/tracing/TraceEvent.h" | 175 #include "platform/tracing/TraceEvent.h" |
| 176 #include "platform/weborigin/KURL.h" | 176 #include "platform/weborigin/KURL.h" |
| 177 #include "platform/weborigin/SchemeRegistry.h" | 177 #include "platform/weborigin/SchemeRegistry.h" |
| 178 #include "platform/weborigin/SecurityPolicy.h" | 178 #include "platform/weborigin/SecurityPolicy.h" |
| 179 #include "public/platform/InterfaceProvider.h" | 179 #include "public/platform/InterfaceProvider.h" |
| 180 #include "public/platform/InterfaceRegistry.h" | |
| 180 #include "public/platform/WebDoubleSize.h" | 181 #include "public/platform/WebDoubleSize.h" |
| 181 #include "public/platform/WebFloatPoint.h" | 182 #include "public/platform/WebFloatPoint.h" |
| 182 #include "public/platform/WebFloatRect.h" | 183 #include "public/platform/WebFloatRect.h" |
| 183 #include "public/platform/WebLayer.h" | 184 #include "public/platform/WebLayer.h" |
| 184 #include "public/platform/WebPoint.h" | 185 #include "public/platform/WebPoint.h" |
| 185 #include "public/platform/WebRect.h" | 186 #include "public/platform/WebRect.h" |
| 186 #include "public/platform/WebSecurityOrigin.h" | 187 #include "public/platform/WebSecurityOrigin.h" |
| 187 #include "public/platform/WebSize.h" | 188 #include "public/platform/WebSize.h" |
| 188 #include "public/platform/WebSuspendableTask.h" | 189 #include "public/platform/WebSuspendableTask.h" |
| 189 #include "public/platform/WebURLError.h" | 190 #include "public/platform/WebURLError.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 #include "web/WebDevToolsAgentImpl.h" | 222 #include "web/WebDevToolsAgentImpl.h" |
| 222 #include "web/WebFrameWidgetImpl.h" | 223 #include "web/WebFrameWidgetImpl.h" |
| 223 #include "web/WebPluginContainerImpl.h" | 224 #include "web/WebPluginContainerImpl.h" |
| 224 #include "web/WebRemoteFrameImpl.h" | 225 #include "web/WebRemoteFrameImpl.h" |
| 225 #include "web/WebViewImpl.h" | 226 #include "web/WebViewImpl.h" |
| 226 #include "wtf/CurrentTime.h" | 227 #include "wtf/CurrentTime.h" |
| 227 #include "wtf/HashMap.h" | 228 #include "wtf/HashMap.h" |
| 228 #include "wtf/PtrUtil.h" | 229 #include "wtf/PtrUtil.h" |
| 229 #include <algorithm> | 230 #include <algorithm> |
| 230 #include <memory> | 231 #include <memory> |
| 232 #include <utility> | |
| 231 | 233 |
| 232 namespace blink { | 234 namespace blink { |
| 233 | 235 |
| 234 static int frameCount = 0; | 236 static int frameCount = 0; |
| 235 | 237 |
| 236 static HeapVector<ScriptSourceCode> createSourcesVector( | 238 static HeapVector<ScriptSourceCode> createSourcesVector( |
| 237 const WebScriptSource* sourcesIn, | 239 const WebScriptSource* sourcesIn, |
| 238 unsigned numSources) { | 240 unsigned numSources) { |
| 239 HeapVector<ScriptSourceCode> sources; | 241 HeapVector<ScriptSourceCode> sources; |
| 240 sources.append(sourcesIn, numSources); | 242 sources.append(sourcesIn, numSources); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1607 const AtomicString& uniqueName) { | 1609 const AtomicString& uniqueName) { |
| 1608 setCoreFrame( | 1610 setCoreFrame( |
| 1609 LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner, | 1611 LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner, |
| 1610 client() ? client()->interfaceProvider() : nullptr, | 1612 client() ? client()->interfaceProvider() : nullptr, |
| 1611 client() ? client()->interfaceRegistry() : nullptr)); | 1613 client() ? client()->interfaceRegistry() : nullptr)); |
| 1612 frame()->tree().setPrecalculatedName(name, uniqueName); | 1614 frame()->tree().setPrecalculatedName(name, uniqueName); |
| 1613 // We must call init() after m_frame is assigned because it is referenced | 1615 // We must call init() after m_frame is assigned because it is referenced |
| 1614 // during init(). Note that this may dispatch JS events; the frame may be | 1616 // during init(). Note that this may dispatch JS events; the frame may be |
| 1615 // detached after init() returns. | 1617 // detached after init() returns. |
| 1616 frame()->init(); | 1618 frame()->init(); |
| 1617 if (frame() && | 1619 if (frame()) { |
| 1618 frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() && | 1620 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() && |
| 1619 !parent() && !opener() && | 1621 !parent() && !opener() && |
| 1620 frame()->settings()->shouldReuseGlobalForUnownedMainFrame()) | 1622 frame()->settings()->shouldReuseGlobalForUnownedMainFrame()) { |
| 1621 frame()->document()->getSecurityOrigin()->grantUniversalAccess(); | 1623 frame()->document()->getSecurityOrigin()->grantUniversalAccess(); |
| 1624 } | |
| 1625 | |
| 1626 frame()->interfaceRegistry()->addInterface( | |
| 1627 WTF::bind(&AppBannerController::create, wrapPersistent(frame()))); | |
|
haraken
2016/10/20 15:51:23
I'm just curious but why does addInterface take a
dominickn
2016/10/20 23:41:18
addInterface registers a WTF::Function(request) ca
haraken
2016/10/21 08:59:45
Sorry for being noisy, but where is the expected r
dominickn
2016/10/21 12:26:57
The short answer is template magic. :)
The long a
haraken
2016/10/23 22:42:15
Thanks, makes sense.
I'd personally prefer a more
| |
| 1628 } | |
| 1622 } | 1629 } |
| 1623 | 1630 |
| 1624 LocalFrame* WebLocalFrameImpl::createChildFrame( | 1631 LocalFrame* WebLocalFrameImpl::createChildFrame( |
| 1625 const FrameLoadRequest& request, | 1632 const FrameLoadRequest& request, |
| 1626 const AtomicString& name, | 1633 const AtomicString& name, |
| 1627 HTMLFrameOwnerElement* ownerElement) { | 1634 HTMLFrameOwnerElement* ownerElement) { |
| 1628 DCHECK(m_client); | 1635 DCHECK(m_client); |
| 1629 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1636 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); |
| 1630 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1637 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
| 1631 ? WebTreeScopeType::Document | 1638 ? WebTreeScopeType::Document |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2082 | 2089 |
| 2083 // Screen Orientation API | 2090 // Screen Orientation API |
| 2084 if (ScreenOrientationController::from(*frame())) | 2091 if (ScreenOrientationController::from(*frame())) |
| 2085 ScreenOrientationController::from(*frame())->notifyOrientationChanged(); | 2092 ScreenOrientationController::from(*frame())->notifyOrientationChanged(); |
| 2086 | 2093 |
| 2087 // Legacy window.orientation API | 2094 // Legacy window.orientation API |
| 2088 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow()) | 2095 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow()) |
| 2089 frame()->localDOMWindow()->sendOrientationChangeEvent(); | 2096 frame()->localDOMWindow()->sendOrientationChangeEvent(); |
| 2090 } | 2097 } |
| 2091 | 2098 |
| 2092 void WebLocalFrameImpl::willShowInstallBannerPrompt( | |
| 2093 int requestId, | |
| 2094 const WebVector<WebString>& platforms, | |
| 2095 WebAppBannerPromptReply* reply) { | |
| 2096 if (!frame()) | |
| 2097 return; | |
| 2098 | |
| 2099 AppBannerController::willShowInstallBannerPrompt( | |
| 2100 requestId, client()->appBannerClient(), frame(), platforms, reply); | |
| 2101 } | |
| 2102 | |
| 2103 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const { | 2099 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const { |
| 2104 DCHECK(frame()); | 2100 DCHECK(frame()); |
| 2105 DCHECK(frame()->document()); | 2101 DCHECK(frame()->document()); |
| 2106 frame()->document()->postSuspendableTask( | 2102 frame()->document()->postSuspendableTask( |
| 2107 WebSuspendableTaskWrapper::create(wrapUnique(task))); | 2103 WebSuspendableTaskWrapper::create(wrapUnique(task))); |
| 2108 } | 2104 } |
| 2109 | 2105 |
| 2110 void WebLocalFrameImpl::didCallAddSearchProvider() { | 2106 void WebLocalFrameImpl::didCallAddSearchProvider() { |
| 2111 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); | 2107 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); |
| 2112 } | 2108 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2379 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; | 2375 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; |
| 2380 } else if (metric == "wasAlternateProtocolAvailable") { | 2376 } else if (metric == "wasAlternateProtocolAvailable") { |
| 2381 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; | 2377 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; |
| 2382 } else if (metric == "connectionInfo") { | 2378 } else if (metric == "connectionInfo") { |
| 2383 feature = UseCounter::ChromeLoadTimesConnectionInfo; | 2379 feature = UseCounter::ChromeLoadTimesConnectionInfo; |
| 2384 } | 2380 } |
| 2385 UseCounter::count(frame(), feature); | 2381 UseCounter::count(frame(), feature); |
| 2386 } | 2382 } |
| 2387 | 2383 |
| 2388 } // namespace blink | 2384 } // namespace blink |
| OLD | NEW |