| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 Google Inc. All Rights Reserved. | 2 * Copyright 2007 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 // WebView ---------------------------------------------------------------- | 307 // WebView ---------------------------------------------------------------- |
| 308 | 308 |
| 309 /*static*/ | 309 /*static*/ |
| 310 WebView* WebView::Create(WebViewDelegate* delegate, | 310 WebView* WebView::Create(WebViewDelegate* delegate, |
| 311 const WebPreferences& prefs) { | 311 const WebPreferences& prefs) { |
| 312 WebViewImpl* instance = new WebViewImpl(); | 312 WebViewImpl* instance = new WebViewImpl(); |
| 313 instance->AddRef(); | 313 instance->AddRef(); |
| 314 instance->SetPreferences(prefs); | 314 instance->SetPreferences(prefs); |
| 315 | 315 |
| 316 // Here, we construct a new WebFrameImpl with a reference count of 0. That | 316 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame |
| 317 // is bumped up to 1 by InitMainFrame. The reference count is decremented | 317 // and releases that reference once the corresponding Frame is destroyed. |
| 318 // when the corresponding WebCore::Frame object is destroyed. | 318 scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl(); |
| 319 WebFrameImpl* main_frame = new WebFrameImpl(); | 319 |
| 320 // Set the delegate before initializing the frame, so that notifications like |
| 321 // DidCreateDataSource make their way to the client. |
| 322 instance->delegate_ = delegate; |
| 320 main_frame->InitMainFrame(instance); | 323 main_frame->InitMainFrame(instance); |
| 321 | 324 |
| 322 // Set the delegate after initializing the main frame, to avoid trying to | |
| 323 // respond to notifications before we're fully initialized. | |
| 324 instance->delegate_ = delegate; | |
| 325 | |
| 326 WebDevToolsAgentDelegate* tools_delegate = | 325 WebDevToolsAgentDelegate* tools_delegate = |
| 327 delegate->GetWebDevToolsAgentDelegate(); | 326 delegate->GetWebDevToolsAgentDelegate(); |
| 328 if (tools_delegate) { | 327 if (tools_delegate) { |
| 329 instance->devtools_agent_.reset( | 328 instance->devtools_agent_.reset( |
| 330 new WebDevToolsAgentImpl(instance, tools_delegate)); | 329 new WebDevToolsAgentImpl(instance, tools_delegate)); |
| 331 } | 330 } |
| 332 | 331 |
| 333 // Restrict the access to the local file system | 332 // Restrict the access to the local file system |
| 334 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 333 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
| 335 FrameLoader::setLocalLoadPolicy( | 334 FrameLoader::setLocalLoadPolicy( |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 | 1940 |
| 1942 return document->focusedNode(); | 1941 return document->focusedNode(); |
| 1943 } | 1942 } |
| 1944 | 1943 |
| 1945 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { | 1944 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { |
| 1946 IntPoint doc_point( | 1945 IntPoint doc_point( |
| 1947 page_->mainFrame()->view()->windowToContents(pos)); | 1946 page_->mainFrame()->view()->windowToContents(pos)); |
| 1948 return page_->mainFrame()->eventHandler()-> | 1947 return page_->mainFrame()->eventHandler()-> |
| 1949 hitTestResultAtPoint(doc_point, false); | 1948 hitTestResultAtPoint(doc_point, false); |
| 1950 } | 1949 } |
| OLD | NEW |