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_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/background_contents_service.h" | 13 #include "chrome/browser/background_contents_service.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/history/history_marshaling.h" | 15 #include "chrome/browser/history/history_marshaling.h" |
| 16 #include "chrome/browser/history/history_tab_helper.h" |
16 #include "chrome/browser/prerender/prerender_final_status.h" | 17 #include "chrome/browser/prerender/prerender_final_status.h" |
17 #include "chrome/browser/prerender/prerender_manager.h" | 18 #include "chrome/browser/prerender/prerender_manager.h" |
18 #include "chrome/browser/prerender/prerender_render_widget_host_view.h" | 19 #include "chrome/browser/prerender/prerender_render_widget_host_view.h" |
19 #include "chrome/browser/prerender/prerender_tracker.h" | 20 #include "chrome/browser/prerender/prerender_tracker.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/renderer_preferences_util.h" | 22 #include "chrome/browser/renderer_preferences_util.h" |
22 #include "chrome/browser/ui/download/download_tab_helper.h" | 23 #include "chrome/browser/ui/download/download_tab_helper.h" |
23 #include "chrome/browser/ui/login/login_prompt.h" | 24 #include "chrome/browser/ui/login/login_prompt.h" |
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
25 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} | 101 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} |
101 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} | 102 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} |
102 virtual bool ShouldAddNavigationToHistory( | 103 virtual bool ShouldAddNavigationToHistory( |
103 const history::HistoryAddPageArgs& add_page_args, | 104 const history::HistoryAddPageArgs& add_page_args, |
104 NavigationType::Type navigation_type) { | 105 NavigationType::Type navigation_type) { |
105 add_page_vector_.push_back( | 106 add_page_vector_.push_back( |
106 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); | 107 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); |
107 return false; | 108 return false; |
108 } | 109 } |
109 // Commits the History of Pages to the given TabContents. | 110 // Commits the History of Pages to the given TabContents. |
110 void CommitHistory(TabContents* tc) { | 111 void CommitHistory(TabContentsWrapper* tab) { |
111 DCHECK(tc != NULL); | |
112 for (size_t i = 0; i < add_page_vector_.size(); ++i) | 112 for (size_t i = 0; i < add_page_vector_.size(); ++i) |
113 tc->UpdateHistoryForNavigation(add_page_vector_[i].get()); | 113 tab->history_tab_helper()->UpdateHistoryForNavigation( |
| 114 add_page_vector_[i].get()); |
114 } | 115 } |
115 | 116 |
116 private: | 117 private: |
117 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > | 118 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > |
118 AddPageVector; | 119 AddPageVector; |
119 | 120 |
120 // Caches pages to be added to the history. | 121 // Caches pages to be added to the history. |
121 AddPageVector add_page_vector_; | 122 AddPageVector add_page_vector_; |
122 | 123 |
123 PrerenderContents* prerender_contents_; | 124 PrerenderContents* prerender_contents_; |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // TODO(mmenke): Replace with simple accessor once TabContents is always | 826 // TODO(mmenke): Replace with simple accessor once TabContents is always |
826 // used. | 827 // used. |
827 if (UseTabContents()) { | 828 if (UseTabContents()) { |
828 if (!prerender_contents_.get()) | 829 if (!prerender_contents_.get()) |
829 return NULL; | 830 return NULL; |
830 return prerender_contents_->render_view_host(); | 831 return prerender_contents_->render_view_host(); |
831 } | 832 } |
832 return render_view_host_; | 833 return render_view_host_; |
833 } | 834 } |
834 | 835 |
835 void PrerenderContents::CommitHistory(TabContents* tc) { | 836 void PrerenderContents::CommitHistory(TabContentsWrapper* tab) { |
836 if (tab_contents_delegate_.get()) | 837 if (tab_contents_delegate_.get()) |
837 tab_contents_delegate_->CommitHistory(tc); | 838 tab_contents_delegate_->CommitHistory(tab); |
838 } | 839 } |
839 | 840 |
840 } // namespace prerender | 841 } // namespace prerender |
OLD | NEW |