Chromium Code Reviews| 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 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); | |
|
gavinp
2013/01/03 17:20:10
This simply isn't always true.
mmenke
2013/01/03 17:23:47
My understanding of the world will never be the sa
| |
| 476 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStopLoading(this)); | |
| 477 } | |
| 478 | |
| 470 void PrerenderContents::NotifyPrerenderStop() { | 479 void PrerenderContents::NotifyPrerenderStop() { |
| 471 DCHECK_NE(FINAL_STATUS_MAX, final_status_); | 480 DCHECK_NE(FINAL_STATUS_MAX, final_status_); |
| 472 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); | 481 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); |
| 473 observer_list_.Clear(); | 482 observer_list_.Clear(); |
| 474 } | 483 } |
| 475 | 484 |
| 476 void PrerenderContents::NotifyPrerenderAddAlias(const GURL& alias_url) { | 485 void PrerenderContents::NotifyPrerenderAddAlias(const GURL& alias_url) { |
| 477 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderAddAlias(this, | 486 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderAddAlias(this, |
| 478 alias_url)); | 487 alias_url)); |
| 479 } | 488 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 std::bind2nd(std::equal_to<GURL>(), url)) != 0; | 543 std::bind2nd(std::equal_to<GURL>(), url)) != 0; |
| 535 } | 544 } |
| 536 | 545 |
| 537 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { | 546 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { |
| 538 Destroy(FINAL_STATUS_RENDERER_CRASHED); | 547 Destroy(FINAL_STATUS_RENDERER_CRASHED); |
| 539 } | 548 } |
| 540 | 549 |
| 541 void PrerenderContents::DidStopLoading( | 550 void PrerenderContents::DidStopLoading( |
| 542 content::RenderViewHost* render_view_host) { | 551 content::RenderViewHost* render_view_host) { |
| 543 has_stopped_loading_ = true; | 552 has_stopped_loading_ = true; |
| 553 NotifyPrerenderStopLoading(); | |
| 544 } | 554 } |
| 545 | 555 |
| 546 void PrerenderContents::DidStartProvisionalLoadForFrame( | 556 void PrerenderContents::DidStartProvisionalLoadForFrame( |
| 547 int64 frame_id, | 557 int64 frame_id, |
| 548 int64 parent_frame_id, | 558 int64 parent_frame_id, |
| 549 bool is_main_frame, | 559 bool is_main_frame, |
| 550 const GURL& validated_url, | 560 const GURL& validated_url, |
| 551 bool is_error_page, | 561 bool is_error_page, |
| 552 RenderViewHost* render_view_host) { | 562 RenderViewHost* render_view_host) { |
| 553 if (is_main_frame) { | 563 if (is_main_frame) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 | 696 |
| 687 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 697 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 688 if (!prerender_contents_) | 698 if (!prerender_contents_) |
| 689 return false; | 699 return false; |
| 690 return (prerender_contents_->GetSiteInstance() != | 700 return (prerender_contents_->GetSiteInstance() != |
| 691 prerender_contents_->GetPendingSiteInstance()); | 701 prerender_contents_->GetPendingSiteInstance()); |
| 692 } | 702 } |
| 693 | 703 |
| 694 | 704 |
| 695 } // namespace prerender | 705 } // namespace prerender |
| OLD | NEW |