| 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 const history::HistoryAddPageArgs& add_page_args) { | 723 const history::HistoryAddPageArgs& add_page_args) { |
| 724 add_page_vector_.push_back(add_page_args); | 724 add_page_vector_.push_back(add_page_args); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void PrerenderContents::CommitHistory(WebContents* tab) { | 727 void PrerenderContents::CommitHistory(WebContents* tab) { |
| 728 HistoryTabHelper* history_tab_helper = HistoryTabHelper::FromWebContents(tab); | 728 HistoryTabHelper* history_tab_helper = HistoryTabHelper::FromWebContents(tab); |
| 729 for (size_t i = 0; i < add_page_vector_.size(); ++i) | 729 for (size_t i = 0; i < add_page_vector_.size(); ++i) |
| 730 history_tab_helper->UpdateHistoryForNavigation(add_page_vector_[i]); | 730 history_tab_helper->UpdateHistoryForNavigation(add_page_vector_[i]); |
| 731 } | 731 } |
| 732 | 732 |
| 733 Value* PrerenderContents::GetAsValue() const { | 733 base::Value* PrerenderContents::GetAsValue() const { |
| 734 if (!prerender_contents_.get()) | 734 if (!prerender_contents_.get()) |
| 735 return NULL; | 735 return NULL; |
| 736 DictionaryValue* dict_value = new DictionaryValue(); | 736 base::DictionaryValue* dict_value = new base::DictionaryValue(); |
| 737 dict_value->SetString("url", prerender_url_.spec()); | 737 dict_value->SetString("url", prerender_url_.spec()); |
| 738 base::TimeTicks current_time = base::TimeTicks::Now(); | 738 base::TimeTicks current_time = base::TimeTicks::Now(); |
| 739 base::TimeDelta duration = current_time - load_start_time_; | 739 base::TimeDelta duration = current_time - load_start_time_; |
| 740 dict_value->SetInteger("duration", duration.InSeconds()); | 740 dict_value->SetInteger("duration", duration.InSeconds()); |
| 741 dict_value->SetBoolean("is_loaded", prerender_contents_ && | 741 dict_value->SetBoolean("is_loaded", prerender_contents_ && |
| 742 !prerender_contents_->IsLoading()); | 742 !prerender_contents_->IsLoading()); |
| 743 return dict_value; | 743 return dict_value; |
| 744 } | 744 } |
| 745 | 745 |
| 746 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 746 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 747 if (!prerender_contents_) | 747 if (!prerender_contents_) |
| 748 return false; | 748 return false; |
| 749 return (prerender_contents_->GetSiteInstance() != | 749 return (prerender_contents_->GetSiteInstance() != |
| 750 prerender_contents_->GetPendingSiteInstance()); | 750 prerender_contents_->GetPendingSiteInstance()); |
| 751 } | 751 } |
| 752 | 752 |
| 753 SessionStorageNamespace* PrerenderContents::GetSessionStorageNamespace() const { | 753 SessionStorageNamespace* PrerenderContents::GetSessionStorageNamespace() const { |
| 754 if (!prerender_contents()) | 754 if (!prerender_contents()) |
| 755 return NULL; | 755 return NULL; |
| 756 return prerender_contents()->GetController(). | 756 return prerender_contents()->GetController(). |
| 757 GetDefaultSessionStorageNamespace(); | 757 GetDefaultSessionStorageNamespace(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 void PrerenderContents::OnCancelPrerenderForPrinting() { | 760 void PrerenderContents::OnCancelPrerenderForPrinting() { |
| 761 Destroy(FINAL_STATUS_WINDOW_PRINT); | 761 Destroy(FINAL_STATUS_WINDOW_PRINT); |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace prerender | 764 } // namespace prerender |
| OLD | NEW |