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/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 DCHECK(old_tab_contents); | 591 DCHECK(old_tab_contents); |
592 | 592 |
593 MarkTabContentsAsPrerendered(new_tab_contents->tab_contents()); | 593 MarkTabContentsAsPrerendered(new_tab_contents->tab_contents()); |
594 | 594 |
595 // Merge the browsing history. | 595 // Merge the browsing history. |
596 new_tab_contents->controller().CopyStateFromAndPrune( | 596 new_tab_contents->controller().CopyStateFromAndPrune( |
597 &old_tab_contents->controller(), | 597 &old_tab_contents->controller(), |
598 false); | 598 false); |
599 old_tab_contents->delegate()->SwapTabContents(old_tab_contents, | 599 old_tab_contents->delegate()->SwapTabContents(old_tab_contents, |
600 new_tab_contents); | 600 new_tab_contents); |
601 prerender_contents->CommitHistory(new_tab_contents->tab_contents()); | 601 prerender_contents->CommitHistory(new_tab_contents); |
602 | 602 |
603 GURL icon_url = prerender_contents->icon_url(); | 603 GURL icon_url = prerender_contents->icon_url(); |
604 if (!icon_url.is_empty()) { | 604 if (!icon_url.is_empty()) { |
605 std::vector<FaviconURL> urls; | 605 std::vector<FaviconURL> urls; |
606 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 606 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); |
607 new_tab_contents->favicon_tab_helper()->OnUpdateFaviconURL( | 607 new_tab_contents->favicon_tab_helper()->OnUpdateFaviconURL( |
608 prerender_contents->page_id(), | 608 prerender_contents->page_id(), |
609 urls); | 609 urls); |
610 } | 610 } |
611 | 611 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 base::TimeTicks cutoff = GetCurrentTimeTicks() - | 1009 base::TimeTicks cutoff = GetCurrentTimeTicks() - |
1010 base::TimeDelta::FromMilliseconds(kNavigationRecordWindowMs); | 1010 base::TimeDelta::FromMilliseconds(kNavigationRecordWindowMs); |
1011 while (!navigations_.empty()) { | 1011 while (!navigations_.empty()) { |
1012 if (navigations_.front().time_ > cutoff) | 1012 if (navigations_.front().time_ > cutoff) |
1013 break; | 1013 break; |
1014 navigations_.pop_front(); | 1014 navigations_.pop_front(); |
1015 } | 1015 } |
1016 } | 1016 } |
1017 | 1017 |
1018 } // namespace prerender | 1018 } // namespace prerender |
OLD | NEW |