OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 NotificationType::FRAME_PROVISIONAL_LOAD_START, | 1628 NotificationType::FRAME_PROVISIONAL_LOAD_START, |
1629 Source<NavigationController>(&controller_), | 1629 Source<NavigationController>(&controller_), |
1630 Details<ProvisionalLoadDetails>(&details)); | 1630 Details<ProvisionalLoadDetails>(&details)); |
1631 if (is_main_frame) { | 1631 if (is_main_frame) { |
1632 // If we're displaying a network error page do not reset the content | 1632 // If we're displaying a network error page do not reset the content |
1633 // settings delegate's cookies so the user has a chance to modify cookie | 1633 // settings delegate's cookies so the user has a chance to modify cookie |
1634 // settings. | 1634 // settings. |
1635 if (!is_error_page) | 1635 if (!is_error_page) |
1636 content_settings_delegate_->ClearCookieSpecificContentSettings(); | 1636 content_settings_delegate_->ClearCookieSpecificContentSettings(); |
1637 content_settings_delegate_->ClearGeolocationContentSettings(); | 1637 content_settings_delegate_->ClearGeolocationContentSettings(); |
1638 | |
1639 // Check if the URL we are about to load has been prerendered by any chance, | |
1640 // and use it if possible. | |
1641 PrerenderManager* pm = profile()->GetPrerenderManager(); | |
cbentzel
2011/01/19 17:08:03
This block of code is now repeated three times - m
tburkard
2011/01/19 19:00:45
Done.
| |
1642 if (pm != NULL) { | |
1643 if (pm->MaybeUsePreloadedPage(this, url)) { | |
1644 // TODO(tburkard): If the preloaded page has not finished preloading | |
1645 // yet, we should not do this. | |
1646 DidStopLoading(); | |
1647 } | |
1648 } | |
1638 } | 1649 } |
1639 } | 1650 } |
1640 | 1651 |
1641 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, | 1652 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, |
1642 const GURL& source_url, | 1653 const GURL& source_url, |
1643 const GURL& target_url) { | 1654 const GURL& target_url) { |
1644 NavigationEntry* entry; | 1655 NavigationEntry* entry; |
1645 if (page_id == -1) | 1656 if (page_id == -1) |
1646 entry = controller_.pending_entry(); | 1657 entry = controller_.pending_entry(); |
1647 else | 1658 else |
1648 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); | 1659 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); |
1649 if (!entry || entry->url() != source_url) | 1660 if (!entry || entry->url() != source_url) |
1650 return; | 1661 return; |
1651 entry->set_url(target_url); | 1662 entry->set_url(target_url); |
1663 | |
1664 // Check if the URL we are about to load has been prerendered by any chance, | |
1665 // and use it if possible. | |
1666 PrerenderManager* pm = profile()->GetPrerenderManager(); | |
1667 if (pm != NULL) { | |
1668 if (pm->MaybeUsePreloadedPage(this, target_url)) { | |
1669 // TODO(tburkard): If the preloaded page has not finished preloading | |
1670 // yet, we should not do this. | |
1671 DidStopLoading(); | |
1672 } | |
1673 } | |
1652 } | 1674 } |
1653 | 1675 |
1654 void TabContents::OnDidFailProvisionalLoadWithError( | 1676 void TabContents::OnDidFailProvisionalLoadWithError( |
1655 int64 frame_id, | 1677 int64 frame_id, |
1656 bool is_main_frame, | 1678 bool is_main_frame, |
1657 int error_code, | 1679 int error_code, |
1658 const GURL& url, | 1680 const GURL& url, |
1659 bool showing_repost_interstitial) { | 1681 bool showing_repost_interstitial) { |
1660 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() | 1682 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() |
1661 << ", error_code: " << error_code | 1683 << ", error_code: " << error_code |
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3371 } | 3393 } |
3372 | 3394 |
3373 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3395 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3374 render_manager_.SwapInRenderViewHost(rvh); | 3396 render_manager_.SwapInRenderViewHost(rvh); |
3375 } | 3397 } |
3376 | 3398 |
3377 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3399 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3378 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3400 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3379 rwh_view->SetSize(view()->GetContainerSize()); | 3401 rwh_view->SetSize(view()->GetContainerSize()); |
3380 } | 3402 } |
OLD | NEW |