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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 99283: Add a BeforeDestroyFrame notification method to WebViewDelegate (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | webkit/glue/webframeloaderclient_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #include "base/string_util.h" 134 #include "base/string_util.h"
135 #include "net/base/net_errors.h" 135 #include "net/base/net_errors.h"
136 #include "skia/ext/bitmap_platform_device.h" 136 #include "skia/ext/bitmap_platform_device.h"
137 #include "skia/ext/platform_canvas.h" 137 #include "skia/ext/platform_canvas.h"
138 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" 138 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
139 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" 139 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
140 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" 140 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
141 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" 141 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
142 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" 142 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
143 #include "webkit/glue/alt_error_page_resource_fetcher.h" 143 #include "webkit/glue/alt_error_page_resource_fetcher.h"
144 #include "webkit/glue/chrome_client_impl.h"
144 #include "webkit/glue/dom_operations.h" 145 #include "webkit/glue/dom_operations.h"
145 #include "webkit/glue/dom_operations_private.h" 146 #include "webkit/glue/dom_operations_private.h"
146 #include "webkit/glue/feed.h" 147 #include "webkit/glue/feed.h"
147 #include "webkit/glue/glue_serialize.h" 148 #include "webkit/glue/glue_serialize.h"
148 #include "webkit/glue/glue_util.h" 149 #include "webkit/glue/glue_util.h"
149 #include "webkit/glue/webappcachecontext.h" 150 #include "webkit/glue/webappcachecontext.h"
150 #include "webkit/glue/webdatasource_impl.h" 151 #include "webkit/glue/webdatasource_impl.h"
151 #include "webkit/glue/weberror_impl.h" 152 #include "webkit/glue/weberror_impl.h"
152 #include "webkit/glue/webframe_impl.h" 153 #include "webkit/glue/webframe_impl.h"
153 #include "webkit/glue/webhistoryitem_impl.h" 154 #include "webkit/glue/webhistoryitem_impl.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 StatsCounter(kWebFrameActiveCount).Decrement(); 375 StatsCounter(kWebFrameActiveCount).Decrement();
375 live_object_count_--; 376 live_object_count_--;
376 377
377 CancelPendingScopingEffort(); 378 CancelPendingScopingEffort();
378 ClearPasswordListeners(); 379 ClearPasswordListeners();
379 } 380 }
380 381
381 // WebFrame ------------------------------------------------------------------- 382 // WebFrame -------------------------------------------------------------------
382 383
383 void WebFrameImpl::InitMainFrame(WebViewImpl* webview_impl) { 384 void WebFrameImpl::InitMainFrame(WebViewImpl* webview_impl) {
384 webview_impl_ = webview_impl;
385
386 RefPtr<Frame> frame = 385 RefPtr<Frame> frame =
387 Frame::create(webview_impl_->page(), 0, &frame_loader_client_); 386 Frame::create(webview_impl->page(), 0, &frame_loader_client_);
388 frame_ = frame.get(); 387 frame_ = frame.get();
389 388
390 // Add reference on behalf of FrameLoader. See comments in 389 // Add reference on behalf of FrameLoader. See comments in
391 // WebFrameLoaderClient::frameLoaderDestroyed for more info. 390 // WebFrameLoaderClient::frameLoaderDestroyed for more info.
392 AddRef(); 391 AddRef();
393 392
394 // We must call init() after frame_ is assigned because it is referenced 393 // We must call init() after frame_ is assigned because it is referenced
395 // during init(). 394 // during init().
396 frame_->init(); 395 frame_->init();
397 396
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem(); 469 RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem();
471 470
472 // If there is no current_item, which happens when we are navigating in 471 // If there is no current_item, which happens when we are navigating in
473 // session history after a crash, we need to manufacture one otherwise 472 // session history after a crash, we need to manufacture one otherwise
474 // WebKit hoarks. This is probably the wrong thing to do, but it seems to 473 // WebKit hoarks. This is probably the wrong thing to do, but it seems to
475 // work. 474 // work.
476 if (!current_item) { 475 if (!current_item) {
477 current_item = HistoryItem::create(); 476 current_item = HistoryItem::create();
478 current_item->setLastVisitWasFailure(true); 477 current_item->setLastVisitWasFailure(true);
479 frame_->loader()->setCurrentHistoryItem(current_item); 478 frame_->loader()->setCurrentHistoryItem(current_item);
480 webview_impl_->SetCurrentHistoryItem(current_item.get()); 479 GetWebViewImpl()->SetCurrentHistoryItem(current_item.get());
481 } 480 }
482 481
483 frame_->loader()->goToItem(request_impl->history_item().get(), 482 frame_->loader()->goToItem(request_impl->history_item().get(),
484 WebCore::FrameLoadTypeIndexedBackForward); 483 WebCore::FrameLoadTypeIndexedBackForward);
485 } else if (resource_request.cachePolicy() == ReloadIgnoringCacheData) { 484 } else if (resource_request.cachePolicy() == ReloadIgnoringCacheData) {
486 frame_->loader()->reload(); 485 frame_->loader()->reload();
487 } else { 486 } else {
488 frame_->loader()->load(resource_request, false); 487 frame_->loader()->load(resource_request, false);
489 } 488 }
490 489
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 622 }
624 623
625 return feedlist; 624 return feedlist;
626 } 625 }
627 626
628 bool WebFrameImpl::GetPreviousHistoryState(std::string* history_state) const { 627 bool WebFrameImpl::GetPreviousHistoryState(std::string* history_state) const {
629 // We use the previous item here because documentState (filled-out forms) 628 // We use the previous item here because documentState (filled-out forms)
630 // only get saved to history when it becomes the previous item. The caller 629 // only get saved to history when it becomes the previous item. The caller
631 // is expected to query the history state after a navigation occurs, after 630 // is expected to query the history state after a navigation occurs, after
632 // the desired history item has become the previous entry. 631 // the desired history item has become the previous entry.
633 RefPtr<HistoryItem> item = webview_impl_->GetPreviousHistoryItem(); 632 RefPtr<HistoryItem> item = GetWebViewImpl()->GetPreviousHistoryItem();
634 if (!item) 633 if (!item)
635 return false; 634 return false;
636 635
637 static StatsCounterTimer history_timer("GetHistoryTimer"); 636 static StatsCounterTimer history_timer("GetHistoryTimer");
638 StatsScope<StatsCounterTimer> history_scope(history_timer); 637 StatsScope<StatsCounterTimer> history_scope(history_timer);
639 638
640 webkit_glue::HistoryItemToString(item, history_state); 639 webkit_glue::HistoryItemToString(item, history_state);
641 return true; 640 return true;
642 } 641 }
643 642
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 823 }
825 824
826 bool WebFrameImpl::GetInViewSourceMode() const { 825 bool WebFrameImpl::GetInViewSourceMode() const {
827 if (frame_) 826 if (frame_)
828 return frame_->inViewSourceMode(); 827 return frame_->inViewSourceMode();
829 828
830 return false; 829 return false;
831 } 830 }
832 831
833 WebView* WebFrameImpl::GetView() const { 832 WebView* WebFrameImpl::GetView() const {
834 return webview_impl_; 833 return GetWebViewImpl();
835 } 834 }
836 835
837 std::string WebFrameImpl::GetSecurityOrigin() const { 836 std::string WebFrameImpl::GetSecurityOrigin() const {
838 if (frame_) { 837 if (frame_) {
839 if (frame_->document()) 838 if (frame_->document())
840 return webkit_glue::StringToStdString( 839 return webkit_glue::StringToStdString(
841 frame_->document()->securityOrigin()->toString()); 840 frame_->document()->securityOrigin()->toString());
842 } 841 }
843 return "null"; 842 return "null";
844 } 843 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1064
1066 // Erase all previous tickmarks and highlighting. 1065 // Erase all previous tickmarks and highlighting.
1067 InvalidateArea(INVALIDATE_ALL); 1066 InvalidateArea(INVALIDATE_ALL);
1068 } 1067 }
1069 1068
1070 return found; 1069 return found;
1071 } 1070 }
1072 1071
1073 int WebFrameImpl::OrdinalOfFirstMatchForFrame(WebFrameImpl* frame) const { 1072 int WebFrameImpl::OrdinalOfFirstMatchForFrame(WebFrameImpl* frame) const {
1074 int ordinal = 0; 1073 int ordinal = 0;
1074 WebViewImpl* web_view = GetWebViewImpl();
1075 WebFrameImpl* const main_frame_impl = 1075 WebFrameImpl* const main_frame_impl =
1076 static_cast<WebFrameImpl*>(GetView()->GetMainFrame()); 1076 static_cast<WebFrameImpl*>(GetView()->GetMainFrame());
1077 // Iterate from the main frame up to (but not including) |frame| and 1077 // Iterate from the main frame up to (but not including) |frame| and
1078 // add up the number of matches found so far. 1078 // add up the number of matches found so far.
1079 for (WebFrameImpl* it = main_frame_impl; 1079 for (WebFrameImpl* it = main_frame_impl;
1080 it != frame; 1080 it != frame;
1081 it = static_cast<WebFrameImpl*>( 1081 it = static_cast<WebFrameImpl*>(
1082 webview_impl_->GetNextFrameAfter(it, true))) { 1082 web_view->GetNextFrameAfter(it, true))) {
1083 if (it->last_match_count_ > 0) 1083 if (it->last_match_count_ > 0)
1084 ordinal += it->last_match_count_; 1084 ordinal += it->last_match_count_;
1085 } 1085 }
1086 1086
1087 return ordinal; 1087 return ordinal;
1088 } 1088 }
1089 1089
1090 bool WebFrameImpl::ShouldScopeMatches(const string16& search_text) { 1090 bool WebFrameImpl::ShouldScopeMatches(const string16& search_text) {
1091 // Don't scope if we can't find a frame or if the frame is not visible. 1091 // Don't scope if we can't find a frame or if the frame is not visible.
1092 // The user may have closed the tab/application, so abort. 1092 // The user may have closed the tab/application, so abort.
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 DCHECK(page); 1519 DCHECK(page);
1520 1520
1521 DCHECK(page->mainFrame() != NULL); 1521 DCHECK(page->mainFrame() != NULL);
1522 1522
1523 bool is_main_frame = frame_ == page->mainFrame(); 1523 bool is_main_frame = frame_ == page->mainFrame();
1524 if (is_main_frame && frame_->view()) 1524 if (is_main_frame && frame_->view())
1525 frame_->view()->setParentVisible(false); 1525 frame_->view()->setParentVisible(false);
1526 1526
1527 frame_->setView(0); 1527 frame_->setView(0);
1528 1528
1529 WebViewImpl* web_view = GetWebViewImpl();
1530
1529 WebCore::FrameView* view; 1531 WebCore::FrameView* view;
1530 if (is_main_frame) { 1532 if (is_main_frame) {
1531 IntSize size = webkit_glue::WebSizeToIntSize(webview_impl_->size()); 1533 IntSize size = webkit_glue::WebSizeToIntSize(web_view->size());
1532 view = new FrameView(frame_, size); 1534 view = new FrameView(frame_, size);
1533 } else { 1535 } else {
1534 view = new FrameView(frame_); 1536 view = new FrameView(frame_);
1535 } 1537 }
1536 1538
1537 frame_->setView(view); 1539 frame_->setView(view);
1538 1540
1539 if (webview_impl_->GetIsTransparent()) 1541 if (web_view->GetIsTransparent())
1540 view->setTransparent(true); 1542 view->setTransparent(true);
1541 1543
1542 // TODO(darin): The Mac code has a comment about this possibly being 1544 // TODO(darin): The Mac code has a comment about this possibly being
1543 // unnecessary. See installInFrame in WebCoreFrameBridge.mm 1545 // unnecessary. See installInFrame in WebCoreFrameBridge.mm
1544 if (frame_->ownerRenderer()) 1546 if (frame_->ownerRenderer())
1545 frame_->ownerRenderer()->setWidget(view); 1547 frame_->ownerRenderer()->setWidget(view);
1546 1548
1547 if (HTMLFrameOwnerElement* owner = frame_->ownerElement()) { 1549 if (HTMLFrameOwnerElement* owner = frame_->ownerElement()) {
1548 view->setCanHaveScrollbars( 1550 view->setCanHaveScrollbars(
1549 owner->scrollingMode() != WebCore::ScrollbarAlwaysOff); 1551 owner->scrollingMode() != WebCore::ScrollbarAlwaysOff);
1550 } 1552 }
1551 1553
1552 if (is_main_frame) 1554 if (is_main_frame)
1553 view->setParentVisible(true); 1555 view->setParentVisible(true);
1554 1556
1555 // FrameViews are created with a refcount of 1 so it needs releasing after we 1557 // FrameViews are created with a refcount of 1 so it needs releasing after we
1556 // assign it to a RefPtr. 1558 // assign it to a RefPtr.
1557 view->deref(); 1559 view->deref();
1558 } 1560 }
1559 1561
1560 // static 1562 // static
1561 WebFrameImpl* WebFrameImpl::FromFrame(WebCore::Frame* frame) { 1563 WebFrameImpl* WebFrameImpl::FromFrame(WebCore::Frame* frame) {
1562 return static_cast<WebFrameLoaderClient*>( 1564 return static_cast<WebFrameLoaderClient*>(
1563 frame->loader()->client())->webframe(); 1565 frame->loader()->client())->webframe();
1564 } 1566 }
1565 1567
1568 WebViewImpl* WebFrameImpl::GetWebViewImpl() const {
1569 if (!frame_ || !frame_->page())
1570 return NULL;
1571
1572 // There are cases where a Frame may outlive its associated Page. Get the
1573 // WebViewImpl by accessing it indirectly through the Frame's Page so that we
1574 // don't have to worry about cleaning up the WebFrameImpl -> WebViewImpl
1575 // pointer. WebCore already clears the Frame's Page pointer when the Page is
1576 // destroyed by the WebViewImpl.
1577 return static_cast<ChromeClientImpl*>(
1578 frame_->page()->chrome()->client())->webview();
1579 }
1580
1566 // WebFrame -------------------------------------------------------------------- 1581 // WebFrame --------------------------------------------------------------------
1567 1582
1568 void WebFrameImpl::Layout() { 1583 void WebFrameImpl::Layout() {
1569 // layout this frame 1584 // layout this frame
1570 FrameView* view = frame_->view(); 1585 FrameView* view = frame_->view();
1571 if (view) 1586 if (view)
1572 view->layout(); 1587 view->layout();
1573 1588
1574 // recursively layout child frames 1589 // recursively layout child frames
1575 Frame* child = frame_->tree()->firstChild(); 1590 Frame* child = frame_->tree()->firstChild();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 return true; 1650 return true;
1636 } 1651 }
1637 1652
1638 bool WebFrameImpl::IsLoading() { 1653 bool WebFrameImpl::IsLoading() {
1639 // I'm assuming this does what we want. 1654 // I'm assuming this does what we want.
1640 return frame_->loader()->isLoading(); 1655 return frame_->loader()->isLoading();
1641 } 1656 }
1642 1657
1643 void WebFrameImpl::Closing() { 1658 void WebFrameImpl::Closing() {
1644 alt_error_page_fetcher_.reset(); 1659 alt_error_page_fetcher_.reset();
1645 webview_impl_ = NULL;
1646 frame_ = NULL; 1660 frame_ = NULL;
1647 } 1661 }
1648 1662
1649 void WebFrameImpl::DidReceiveData(DocumentLoader* loader, 1663 void WebFrameImpl::DidReceiveData(DocumentLoader* loader,
1650 const char* data, int length) { 1664 const char* data, int length) {
1651 // Set the text encoding. This calls begin() for us. It is safe to call 1665 // Set the text encoding. This calls begin() for us. It is safe to call
1652 // this multiple times (Mac does: page/mac/WebCoreFrameBridge.mm). 1666 // this multiple times (Mac does: page/mac/WebCoreFrameBridge.mm).
1653 bool user_chosen = true; 1667 bool user_chosen = true;
1654 String encoding = frame_->loader()->documentLoader()->overrideEncoding(); 1668 String encoding = frame_->loader()->documentLoader()->overrideEncoding();
1655 if (encoding.isNull()) { 1669 if (encoding.isNull()) {
1656 user_chosen = false; 1670 user_chosen = false;
1657 encoding = loader->response().textEncodingName(); 1671 encoding = loader->response().textEncodingName();
1658 } 1672 }
1659 frame_->loader()->setEncoding(encoding, user_chosen); 1673 frame_->loader()->setEncoding(encoding, user_chosen);
1660 1674
1661 // NOTE: mac only does this if there is a document 1675 // NOTE: mac only does this if there is a document
1662 frame_->loader()->addData(data, length); 1676 frame_->loader()->addData(data, length);
1663 1677
1664 // It's possible that we get a DNS failure followed by a second load that 1678 // It's possible that we get a DNS failure followed by a second load that
1665 // succeeds before we hear back from the alternate error page server. In 1679 // succeeds before we hear back from the alternate error page server. In
1666 // that case, cancel the alt error page download. 1680 // that case, cancel the alt error page download.
1667 alt_error_page_fetcher_.reset(); 1681 alt_error_page_fetcher_.reset();
1668 } 1682 }
1669 1683
1670 void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) { 1684 void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) {
1671 // Make sure we never show errors in view source mode. 1685 // Make sure we never show errors in view source mode.
1672 SetInViewSourceMode(false); 1686 SetInViewSourceMode(false);
1673 1687
1674 WebViewDelegate* delegate = webview_impl_->delegate(); 1688 WebViewImpl* web_view = GetWebViewImpl();
1689 WebViewDelegate* delegate = web_view->delegate();
1675 if (delegate) { 1690 if (delegate) {
1676 WebErrorImpl web_error(error); 1691 WebErrorImpl web_error(error);
1677 if (was_provisional) { 1692 if (was_provisional) {
1678 delegate->DidFailProvisionalLoadWithError(webview_impl_, web_error, 1693 delegate->DidFailProvisionalLoadWithError(web_view, web_error, this);
1679 this);
1680 } else { 1694 } else {
1681 delegate->DidFailLoadWithError(webview_impl_, web_error, this); 1695 delegate->DidFailLoadWithError(web_view, web_error, this);
1682 } 1696 }
1683 } 1697 }
1684 } 1698 }
1685 1699
1686 void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request, 1700 void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request,
1687 const WebError& error, 1701 const WebError& error,
1688 const GURL& error_page_url, 1702 const GURL& error_page_url,
1689 bool replace, 1703 bool replace,
1690 const GURL& fake_url) { 1704 const GURL& fake_url) {
1691 // Load alternate HTML in place of the previous request. We create a copy of 1705 // Load alternate HTML in place of the previous request. We create a copy of
1692 // the original request so we can replace its URL with a dummy URL. That 1706 // the original request so we can replace its URL with a dummy URL. That
1693 // prevents other web content from the same origin as the failed URL to 1707 // prevents other web content from the same origin as the failed URL to
1694 // script the error page. 1708 // script the error page.
1695 scoped_ptr<WebRequest> failed_request(request->Clone()); 1709 scoped_ptr<WebRequest> failed_request(request->Clone());
1696 failed_request->SetURL(fake_url); 1710 failed_request->SetURL(fake_url);
1697 1711
1698 LoadAlternateHTMLString(failed_request.get(), std::string(), 1712 LoadAlternateHTMLString(failed_request.get(), std::string(),
1699 error.GetFailedURL(), replace); 1713 error.GetFailedURL(), replace);
1700 1714
1701 WebErrorImpl weberror_impl(error); 1715 WebErrorImpl weberror_impl(error);
1702 alt_error_page_fetcher_.reset( 1716 alt_error_page_fetcher_.reset(
1703 new AltErrorPageResourceFetcher(webview_impl_, weberror_impl, this, 1717 new AltErrorPageResourceFetcher(GetWebViewImpl(), weberror_impl, this,
1704 error_page_url)); 1718 error_page_url));
1705 } 1719 }
1706 1720
1707 void WebFrameImpl::ExecuteScript(const WebScriptSource& source) { 1721 void WebFrameImpl::ExecuteScript(const WebScriptSource& source) {
1708 frame_->loader()->executeScript( 1722 frame_->loader()->executeScript(
1709 WebCore::ScriptSourceCode( 1723 WebCore::ScriptSourceCode(
1710 webkit_glue::WebStringToString(source.code), 1724 webkit_glue::WebStringToString(source.code),
1711 webkit_glue::WebURLToKURL(source.url), 1725 webkit_glue::WebURLToKURL(source.url),
1712 source.startLine)); 1726 source.startLine));
1713 } 1727 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 scoped_refptr<WebFrameImpl> webframe = new WebFrameImpl(); 1782 scoped_refptr<WebFrameImpl> webframe = new WebFrameImpl();
1769 1783
1770 // Add an extra ref on behalf of the Frame/FrameLoader, which references the 1784 // Add an extra ref on behalf of the Frame/FrameLoader, which references the
1771 // WebFrame via the FrameLoaderClient interface. See the comment at the top 1785 // WebFrame via the FrameLoaderClient interface. See the comment at the top
1772 // of this file for more info. 1786 // of this file for more info.
1773 webframe->AddRef(); 1787 webframe->AddRef();
1774 1788
1775 RefPtr<Frame> child_frame = Frame::create( 1789 RefPtr<Frame> child_frame = Frame::create(
1776 frame_->page(), owner_element, &webframe->frame_loader_client_); 1790 frame_->page(), owner_element, &webframe->frame_loader_client_);
1777 webframe->frame_ = child_frame.get(); 1791 webframe->frame_ = child_frame.get();
1778 webframe->webview_impl_ = webview_impl_;
1779 1792
1780 child_frame->tree()->setName(request.frameName()); 1793 child_frame->tree()->setName(request.frameName());
1781 1794
1782 frame_->tree()->appendChild(child_frame); 1795 frame_->tree()->appendChild(child_frame);
1783 1796
1784 // Frame::init() can trigger onload event in the parent frame, 1797 // Frame::init() can trigger onload event in the parent frame,
1785 // which may detach this frame and trigger a null-pointer access 1798 // which may detach this frame and trigger a null-pointer access
1786 // in FrameTree::removeChild. Move init() after appendChild call 1799 // in FrameTree::removeChild. Move init() after appendChild call
1787 // so that webframe->frame_ is in the tree before triggering 1800 // so that webframe->frame_ is in the tree before triggering
1788 // onload event handler. 1801 // onload event handler.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 return password_listeners_.get(input_element); 1979 return password_listeners_.get(input_element);
1967 } 1980 }
1968 1981
1969 void WebFrameImpl::ClearPasswordListeners() { 1982 void WebFrameImpl::ClearPasswordListeners() {
1970 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); 1983 for (PasswordListenerMap::iterator iter = password_listeners_.begin();
1971 iter != password_listeners_.end(); ++iter) { 1984 iter != password_listeners_.end(); ++iter) {
1972 delete iter->second; 1985 delete iter->second;
1973 } 1986 }
1974 password_listeners_.clear(); 1987 password_listeners_.clear();
1975 } 1988 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | webkit/glue/webframeloaderclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698