| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 | 457 |
| 458 StopLoading(); // make sure existing activity stops | 458 StopLoading(); // make sure existing activity stops |
| 459 | 459 |
| 460 // Keep track of the request temporarily. This is effectively a way of | 460 // Keep track of the request temporarily. This is effectively a way of |
| 461 // passing the request to callbacks that may need it. See | 461 // passing the request to callbacks that may need it. See |
| 462 // WebFrameLoaderClient::createDocumentLoader. | 462 // WebFrameLoaderClient::createDocumentLoader. |
| 463 currently_loading_request_ = request; | 463 currently_loading_request_ = request; |
| 464 | 464 |
| 465 // If we have a current datasource, save the request info on it immediately. | |
| 466 // This is because WebCore may not actually initiate a load on the toplevel | |
| 467 // frame for some subframe navigations, so we want to update its request. | |
| 468 WebDataSourceImpl* datasource = GetDataSourceImpl(); | |
| 469 if (datasource) | |
| 470 CacheCurrentRequestInfo(datasource); | |
| 471 | |
| 472 if (data.isValid()) { | 465 if (data.isValid()) { |
| 473 frame_->loader()->load(resource_request, data, false); | 466 frame_->loader()->load(resource_request, data, false); |
| 474 if (replace) { | 467 if (replace) { |
| 475 // Do this to force WebKit to treat the load as replacing the currently | 468 // Do this to force WebKit to treat the load as replacing the currently |
| 476 // loaded page. | 469 // loaded page. |
| 477 frame_->loader()->setReplacing(); | 470 frame_->loader()->setReplacing(); |
| 478 } | 471 } |
| 479 } else if (request_impl->history_item()) { | 472 } else if (request_impl->history_item()) { |
| 480 // Use the history item if we have one, otherwise fall back to standard | 473 // Use the history item if we have one, otherwise fall back to standard |
| 481 // load. | 474 // load. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 if (!doc_loader) | 645 if (!doc_loader) |
| 653 doc_loader = frame_loader->policyDocumentLoader(); | 646 doc_loader = frame_loader->policyDocumentLoader(); |
| 654 | 647 |
| 655 return DataSourceForDocLoader(doc_loader); | 648 return DataSourceForDocLoader(doc_loader); |
| 656 } | 649 } |
| 657 | 650 |
| 658 WebDataSourceImpl* WebFrameImpl::GetProvisionalDataSourceImpl() const { | 651 WebDataSourceImpl* WebFrameImpl::GetProvisionalDataSourceImpl() const { |
| 659 return static_cast<WebDataSourceImpl*>(GetProvisionalDataSource()); | 652 return static_cast<WebDataSourceImpl*>(GetProvisionalDataSource()); |
| 660 } | 653 } |
| 661 | 654 |
| 662 void WebFrameImpl::CacheCurrentRequestInfo(WebDataSourceImpl* datasource) { | |
| 663 // Cache our current request info on the data source. It contains its | |
| 664 // own requests, so the extra data needs to be transferred. | |
| 665 scoped_refptr<WebRequest::ExtraData> extra; | |
| 666 | |
| 667 // Our extra data may come from a request issued via LoadRequest. | |
| 668 if (currently_loading_request_) | |
| 669 extra = currently_loading_request_->GetExtraData(); | |
| 670 | |
| 671 // We must only update this if it is valid, or the valid state will be lost. | |
| 672 if (extra) | |
| 673 datasource->SetExtraData(extra); | |
| 674 } | |
| 675 | |
| 676 void WebFrameImpl::StopLoading() { | 655 void WebFrameImpl::StopLoading() { |
| 677 if (!frame_) | 656 if (!frame_) |
| 678 return; | 657 return; |
| 679 | 658 |
| 680 // TODO(darin): Figure out what we should really do here. It seems like a | 659 // TODO(darin): Figure out what we should really do here. It seems like a |
| 681 // bug that FrameLoader::stopLoading doesn't call stopAllLoaders. | 660 // bug that FrameLoader::stopLoading doesn't call stopAllLoaders. |
| 682 frame_->loader()->stopAllLoaders(); | 661 frame_->loader()->stopAllLoaders(); |
| 683 frame_->loader()->stopLoading(false); | 662 frame_->loader()->stopLoading(false); |
| 684 } | 663 } |
| 685 | 664 |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 return password_listeners_.get(input_element); | 1900 return password_listeners_.get(input_element); |
| 1922 } | 1901 } |
| 1923 | 1902 |
| 1924 void WebFrameImpl::ClearPasswordListeners() { | 1903 void WebFrameImpl::ClearPasswordListeners() { |
| 1925 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); | 1904 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); |
| 1926 iter != password_listeners_.end(); ++iter) { | 1905 iter != password_listeners_.end(); ++iter) { |
| 1927 delete iter->second; | 1906 delete iter->second; |
| 1928 } | 1907 } |
| 1929 password_listeners_.clear(); | 1908 password_listeners_.clear(); |
| 1930 } | 1909 } |
| OLD | NEW |