OLD | NEW |
---|---|
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 if (webInputEventKeyState & WebInputEvent::MetaKey) | 263 if (webInputEventKeyState & WebInputEvent::MetaKey) |
264 platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent:: MetaKey; | 264 platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent:: MetaKey; |
265 return platformEventKeyState; | 265 return platformEventKeyState; |
266 } | 266 } |
267 | 267 |
268 // WebView ---------------------------------------------------------------- | 268 // WebView ---------------------------------------------------------------- |
269 | 269 |
270 WebView* WebView::create(WebViewClient* client) | 270 WebView* WebView::create(WebViewClient* client) |
271 { | 271 { |
272 // Pass the WebViewImpl's self-reference to the caller. | 272 // Pass the WebViewImpl's self-reference to the caller. |
273 return WebViewImpl::create(client); | |
274 } | |
275 | |
276 WebViewImpl* WebViewImpl::create(WebViewClient* client) | |
277 { | |
278 // Pass the WebViewImpl's self-reference to the caller. | |
273 return adoptRef(new WebViewImpl(client)).leakRef(); | 279 return adoptRef(new WebViewImpl(client)).leakRef(); |
274 } | 280 } |
275 | 281 |
276 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) | 282 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) |
277 { | 283 { |
278 shouldUseExternalPopupMenus = useExternalPopupMenus; | 284 shouldUseExternalPopupMenus = useExternalPopupMenus; |
279 } | 285 } |
280 | 286 |
281 void WebView::updateVisitedLinkState(unsigned long long linkHash) | 287 void WebView::updateVisitedLinkState(unsigned long long linkHash) |
282 { | 288 { |
(...skipping 23 matching lines...) Expand all Loading... | |
306 } | 312 } |
307 | 313 |
308 void WebView::didExitModalLoop() | 314 void WebView::didExitModalLoop() |
309 { | 315 { |
310 ASSERT(pageGroupLoadDeferrerStack().size()); | 316 ASSERT(pageGroupLoadDeferrerStack().size()); |
311 | 317 |
312 delete pageGroupLoadDeferrerStack().last(); | 318 delete pageGroupLoadDeferrerStack().last(); |
313 pageGroupLoadDeferrerStack().removeLast(); | 319 pageGroupLoadDeferrerStack().removeLast(); |
314 } | 320 } |
315 | 321 |
322 void WebViewImpl::setMainFrame(WebFrame* frame) | |
323 { | |
324 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame | |
darin (slow to review)
2013/09/19 22:36:19
nit: InitMainFrame -> initializeAsMainFrame.
awong
2013/09/20 00:36:24
Done.
| |
325 // and releases that reference once the corresponding Frame is destroyed. | |
326 static_cast<WebFrameImpl*>(frame)->initializeAsMainFrame(page()); | |
327 } | |
328 | |
316 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) | 329 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) |
317 { | 330 { |
318 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame | 331 // NOTE: Previously, WebViewImpl was responsible for allocating its own |
319 // and releases that reference once the corresponding Frame is destroyed. | 332 // mainframe. This code is for supporting clients that have yet to move |
320 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(frameClient); | 333 // to setMainFrame(). Though the setMainFrame() accepts a raw pointer, it |
321 | 334 // implicitly takes a refcount on the frame. Dropping our RefPtr here |
322 frame->initializeAsMainFrame(page()); | 335 // will effectively pass ownership to m_page. New users of WebViewImpl |
323 } | 336 // should call WebFrameImpl::create() to construct their own mainframe, |
324 | 337 // pass it into WebViewImpl::setMainFrame(), keep a pointer to the |
325 void WebViewImpl::initializeHelperPluginFrame(WebFrameClient* client) | 338 // mainframe, and call WebFrameImpl::close() on it when closing the |
326 { | 339 // WebViewImpl. |
327 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(client); | 340 RefPtr<WebFrameImpl> frame = adoptRef(WebFrameImpl::create(frameClient)); |
341 setMainFrame(frame.get()); | |
328 } | 342 } |
329 | 343 |
330 void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) | 344 void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) |
331 { | 345 { |
332 m_autofillClient = autofillClient; | 346 m_autofillClient = autofillClient; |
333 } | 347 } |
334 | 348 |
335 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) | 349 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) |
336 { | 350 { |
337 if (devToolsClient) | 351 if (devToolsClient) |
(...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4171 // the initial viewport width. | 4185 // the initial viewport width. |
4172 // 2. The author has disabled viewport zoom. | 4186 // 2. The author has disabled viewport zoom. |
4173 | 4187 |
4174 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4188 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
4175 | 4189 |
4176 return fixedLayoutSize().width == m_size.width | 4190 return fixedLayoutSize().width == m_size.width |
4177 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4191 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4178 } | 4192 } |
4179 | 4193 |
4180 } // namespace WebKit | 4194 } // namespace WebKit |
OLD | NEW |