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

Side by Side Diff: sky/engine/web/FrameLoaderClientImpl.cpp

Issue 1210153009: Remove (almost all of) //sky/engine/web (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/web/FrameLoaderClientImpl.h ('k') | sky/engine/web/SpellCheckerClientImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #include "sky/engine/web/FrameLoaderClientImpl.h"
33
34 #include "gen/sky/platform/RuntimeEnabledFeatures.h"
35 #include "sky/engine/core/dom/Document.h"
36 #include "sky/engine/core/frame/FrameView.h"
37 #include "sky/engine/core/frame/Settings.h"
38 #include "sky/engine/core/html/HTMLIFrameElement.h"
39 #include "sky/engine/core/page/EventHandler.h"
40 #include "sky/engine/core/page/Page.h"
41 #include "sky/engine/core/rendering/HitTestResult.h"
42 #include "sky/engine/platform/MIMETypeRegistry.h"
43 #include "sky/engine/platform/exported/WrappedResourceRequest.h"
44 #include "sky/engine/platform/exported/WrappedResourceResponse.h"
45 #include "sky/engine/platform/network/HTTPParsers.h"
46 #include "sky/engine/public/platform/Platform.h"
47 #include "sky/engine/public/platform/WebURL.h"
48 #include "sky/engine/public/platform/WebURLError.h"
49 #include "sky/engine/public/platform/WebVector.h"
50 #include "sky/engine/public/web/WebCachedURLRequest.h"
51 #include "sky/engine/public/web/WebDocument.h"
52 #include "sky/engine/public/web/WebFrameClient.h"
53 #include "sky/engine/public/web/WebNode.h"
54 #include "sky/engine/public/web/WebViewClient.h"
55 #include "sky/engine/web/WebLocalFrameImpl.h"
56 #include "sky/engine/web/WebViewImpl.h"
57 #include "sky/engine/wtf/StringExtras.h"
58 #include "sky/engine/wtf/text/CString.h"
59 #include "sky/engine/wtf/text/WTFString.h"
60
61 namespace blink {
62
63 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame)
64 : m_webFrame(frame)
65 {
66 }
67
68 FrameLoaderClientImpl::~FrameLoaderClientImpl()
69 {
70 }
71
72 void FrameLoaderClientImpl::documentElementAvailable()
73 {
74 if (m_webFrame->client())
75 m_webFrame->client()->didCreateDocumentElement(m_webFrame);
76 }
77
78 void FrameLoaderClientImpl::detachedFromParent()
79 {
80 // Alert the client that the frame is being detached. This is the last
81 // chance we have to communicate with the client.
82 RefPtr<WebLocalFrameImpl> protector(m_webFrame);
83
84 WebFrameClient* client = m_webFrame->client();
85 if (!client)
86 return;
87
88 // Signal that no further communication with WebFrameClient should take
89 // place at this point since we are no longer associated with the Page.
90 m_webFrame->setClient(0);
91
92 client->frameDetached(m_webFrame);
93 // Clear our reference to LocalFrame at the very end, in case the client
94 // refers to it.
95 m_webFrame->setCoreFrame(nullptr);
96 }
97
98 void FrameLoaderClientImpl::dispatchWillSendRequest(
99 Document*, unsigned long identifier, ResourceRequest& request,
100 const ResourceResponse& redirectResponse)
101 {
102 // Give the WebFrameClient a crack at the request.
103 if (m_webFrame->client()) {
104 WrappedResourceRequest webreq(request);
105 WrappedResourceResponse webresp(redirectResponse);
106 m_webFrame->client()->willSendRequest(
107 m_webFrame, identifier, webreq, webresp);
108 }
109 }
110
111 void FrameLoaderClientImpl::dispatchDidReceiveResponse(Document*,
112 unsigned long identifier,
113 const ResourceResponse& r esponse)
114 {
115 if (m_webFrame->client()) {
116 WrappedResourceResponse webresp(response);
117 m_webFrame->client()->didReceiveResponse(m_webFrame, identifier, webresp );
118 }
119 }
120
121 void FrameLoaderClientImpl::dispatchDidChangeResourcePriority(unsigned long iden tifier, ResourceLoadPriority priority, int intraPriorityValue)
122 {
123 if (m_webFrame->client())
124 m_webFrame->client()->didChangeResourcePriority(m_webFrame, identifier, static_cast<WebURLRequest::Priority>(priority), intraPriorityValue);
125 }
126
127 // Called when a particular resource load completes
128 void FrameLoaderClientImpl::dispatchDidFinishLoading(Document*,
129 unsigned long identifier)
130 {
131 if (m_webFrame->client())
132 m_webFrame->client()->didFinishResourceLoad(m_webFrame, identifier);
133 }
134
135 void FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache(const Resourc eRequest& request, const ResourceResponse& response)
136 {
137 if (m_webFrame->client())
138 m_webFrame->client()->didLoadResourceFromMemoryCache(m_webFrame, Wrapped ResourceRequest(request), WrappedResourceResponse(response));
139 }
140
141 void FrameLoaderClientImpl::dispatchDidHandleOnloadEvents()
142 {
143 if (m_webFrame->client())
144 m_webFrame->client()->didHandleOnloadEvents(m_webFrame);
145 }
146
147 void FrameLoaderClientImpl::dispatchWillClose()
148 {
149 if (m_webFrame->client())
150 m_webFrame->client()->willClose(m_webFrame);
151 }
152
153 void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title)
154 {
155 if (m_webFrame->client())
156 m_webFrame->client()->didReceiveTitle(m_webFrame, title, WebTextDirectio nLeftToRight);
157 }
158
159 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error)
160 {
161 m_webFrame->didFail(error);
162 }
163
164 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation(const Resource Request& request, Document*, NavigationPolicy policy, bool isTransitionNavigatio n)
165 {
166 if (!m_webFrame->client())
167 return NavigationPolicyIgnore;
168
169 WrappedResourceRequest wrappedResourceRequest(request);
170 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest);
171 navigationInfo.frame = m_webFrame;
172 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy);
173 navigationInfo.isTransitionNavigation = isTransitionNavigation;
174
175 WebNavigationPolicy webPolicy = m_webFrame->client()->decidePolicyForNavigat ion(navigationInfo);
176 return static_cast<NavigationPolicy>(webPolicy);
177 }
178
179 void FrameLoaderClientImpl::dispatchAddNavigationTransitionData(const String& al lowedDestinationOrigin, const String& selector, const String& markup)
180 {
181 if (m_webFrame->client())
182 m_webFrame->client()->addNavigationTransitionData(allowedDestinationOrig in, selector, markup);
183 }
184
185 void FrameLoaderClientImpl::dispatchWillRequestResource(FetchRequest* request)
186 {
187 if (m_webFrame->client()) {
188 WebCachedURLRequest urlRequest(request);
189 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest);
190 }
191 }
192
193 void FrameLoaderClientImpl::didStartLoading(LoadStartType loadStartType)
194 {
195 if (m_webFrame->client())
196 m_webFrame->client()->didStartLoading(loadStartType == NavigationToDiffe rentDocument);
197 }
198
199 void FrameLoaderClientImpl::progressEstimateChanged(double progressEstimate)
200 {
201 if (m_webFrame->client())
202 m_webFrame->client()->didChangeLoadProgress(progressEstimate);
203 }
204
205 void FrameLoaderClientImpl::didStopLoading()
206 {
207 if (m_webFrame->client())
208 m_webFrame->client()->didStopLoading();
209 }
210
211 void FrameLoaderClientImpl::loadURLExternally(const ResourceRequest& request, Na vigationPolicy policy, const String& suggestedName)
212 {
213 if (m_webFrame->client()) {
214 ASSERT(m_webFrame->frame()->document());
215 WrappedResourceRequest webreq(request);
216 m_webFrame->client()->loadURLExternally(
217 m_webFrame, webreq, static_cast<WebNavigationPolicy>(policy), sugges tedName);
218 }
219 }
220
221 mojo::View* FrameLoaderClientImpl::createChildFrame()
222 {
223 if (m_webFrame->client())
224 return m_webFrame->client()->createChildFrame();
225 ASSERT_NOT_REACHED();
226 return nullptr;
227 }
228
229 void FrameLoaderClientImpl::selectorMatchChanged(const Vector<String>& addedSele ctors, const Vector<String>& removedSelectors)
230 {
231 if (WebFrameClient* client = m_webFrame->client())
232 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), We bVector<WebString>(removedSelectors));
233 }
234
235 // Called when the FrameLoader goes into a state in which a new page load
236 // will occur.
237 void FrameLoaderClientImpl::transitionToCommittedForNewPage()
238 {
239 m_webFrame->createFrameView();
240 }
241
242 void FrameLoaderClientImpl::didLoseWebGLContext(int arbRobustnessContextLostReas on)
243 {
244 if (m_webFrame->client())
245 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason);
246 }
247
248 void FrameLoaderClientImpl::dispatchDidChangeManifest()
249 {
250 if (m_webFrame->client())
251 m_webFrame->client()->didChangeManifest(m_webFrame);
252 }
253
254 void FrameLoaderClientImpl::didCreateIsolate(Dart_Isolate isolate) {
255 if (m_webFrame->client())
256 m_webFrame->client()->didCreateIsolate(m_webFrame, isolate);
257 }
258
259 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/FrameLoaderClientImpl.h ('k') | sky/engine/web/SpellCheckerClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698