| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 bool user_gesture) OVERRIDE { | 133 bool user_gesture) OVERRIDE { |
| 134 // TODO(mmenke): Consider supporting this if it is a common case during | 134 // TODO(mmenke): Consider supporting this if it is a common case during |
| 135 // prerenders. | 135 // prerenders. |
| 136 prerender_contents_->Destroy(FINAL_STATUS_REGISTER_PROTOCOL_HANDLER); | 136 prerender_contents_->Destroy(FINAL_STATUS_REGISTER_PROTOCOL_HANDLER); |
| 137 } | 137 } |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 PrerenderContents* prerender_contents_; | 140 PrerenderContents* prerender_contents_; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 void PrerenderContents::Observer::OnPrerenderStopLoading( |
| 144 PrerenderContents* contents) { |
| 145 } |
| 146 |
| 143 void PrerenderContents::Observer::OnPrerenderAddAlias( | 147 void PrerenderContents::Observer::OnPrerenderAddAlias( |
| 144 PrerenderContents* contents, | 148 PrerenderContents* contents, |
| 145 const GURL& alias_url) { | 149 const GURL& alias_url) { |
| 146 } | 150 } |
| 147 | 151 |
| 148 void PrerenderContents::Observer::OnPrerenderCreatedMatchCompleteReplacement( | 152 void PrerenderContents::Observer::OnPrerenderCreatedMatchCompleteReplacement( |
| 149 PrerenderContents* contents, PrerenderContents* replacement) { | 153 PrerenderContents* contents, PrerenderContents* replacement) { |
| 150 } | 154 } |
| 151 | 155 |
| 152 PrerenderContents::Observer::Observer() { | 156 PrerenderContents::Observer::Observer() { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 session_storage_namespace_map[""] = session_storage_namespace; | 464 session_storage_namespace_map[""] = session_storage_namespace; |
| 461 return WebContents::CreateWithSessionStorage( | 465 return WebContents::CreateWithSessionStorage( |
| 462 WebContents::CreateParams(profile_), session_storage_namespace_map); | 466 WebContents::CreateParams(profile_), session_storage_namespace_map); |
| 463 } | 467 } |
| 464 | 468 |
| 465 void PrerenderContents::NotifyPrerenderStart() { | 469 void PrerenderContents::NotifyPrerenderStart() { |
| 466 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); | 470 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); |
| 467 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStart(this)); | 471 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStart(this)); |
| 468 } | 472 } |
| 469 | 473 |
| 474 void PrerenderContents::NotifyPrerenderStopLoading() { |
| 475 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStopLoading(this)); |
| 476 } |
| 477 |
| 470 void PrerenderContents::NotifyPrerenderStop() { | 478 void PrerenderContents::NotifyPrerenderStop() { |
| 471 DCHECK_NE(FINAL_STATUS_MAX, final_status_); | 479 DCHECK_NE(FINAL_STATUS_MAX, final_status_); |
| 472 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); | 480 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); |
| 473 observer_list_.Clear(); | 481 observer_list_.Clear(); |
| 474 } | 482 } |
| 475 | 483 |
| 476 void PrerenderContents::NotifyPrerenderAddAlias(const GURL& alias_url) { | 484 void PrerenderContents::NotifyPrerenderAddAlias(const GURL& alias_url) { |
| 477 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderAddAlias(this, | 485 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderAddAlias(this, |
| 478 alias_url)); | 486 alias_url)); |
| 479 } | 487 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 std::bind2nd(std::equal_to<GURL>(), url)) != 0; | 542 std::bind2nd(std::equal_to<GURL>(), url)) != 0; |
| 535 } | 543 } |
| 536 | 544 |
| 537 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { | 545 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { |
| 538 Destroy(FINAL_STATUS_RENDERER_CRASHED); | 546 Destroy(FINAL_STATUS_RENDERER_CRASHED); |
| 539 } | 547 } |
| 540 | 548 |
| 541 void PrerenderContents::DidStopLoading( | 549 void PrerenderContents::DidStopLoading( |
| 542 content::RenderViewHost* render_view_host) { | 550 content::RenderViewHost* render_view_host) { |
| 543 has_stopped_loading_ = true; | 551 has_stopped_loading_ = true; |
| 552 NotifyPrerenderStopLoading(); |
| 544 } | 553 } |
| 545 | 554 |
| 546 void PrerenderContents::DidStartProvisionalLoadForFrame( | 555 void PrerenderContents::DidStartProvisionalLoadForFrame( |
| 547 int64 frame_id, | 556 int64 frame_id, |
| 548 int64 parent_frame_id, | 557 int64 parent_frame_id, |
| 549 bool is_main_frame, | 558 bool is_main_frame, |
| 550 const GURL& validated_url, | 559 const GURL& validated_url, |
| 551 bool is_error_page, | 560 bool is_error_page, |
| 552 RenderViewHost* render_view_host) { | 561 RenderViewHost* render_view_host) { |
| 553 if (is_main_frame) { | 562 if (is_main_frame) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 695 |
| 687 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 696 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 688 if (!prerender_contents_) | 697 if (!prerender_contents_) |
| 689 return false; | 698 return false; |
| 690 return (prerender_contents_->GetSiteInstance() != | 699 return (prerender_contents_->GetSiteInstance() != |
| 691 prerender_contents_->GetPendingSiteInstance()); | 700 prerender_contents_->GetPendingSiteInstance()); |
| 692 } | 701 } |
| 693 | 702 |
| 694 | 703 |
| 695 } // namespace prerender | 704 } // namespace prerender |
| OLD | NEW |