OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
7 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" | 7 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" |
8 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 8 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
10 #include "components/sessions/content/content_live_tab.h" | 10 #include "components/sessions/content/content_live_tab.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Prepare navigation history. | 73 // Prepare navigation history. |
74 std::vector<std::unique_ptr<content::NavigationEntry>> nav_entries = | 74 std::vector<std::unique_ptr<content::NavigationEntry>> nav_entries = |
75 sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( | 75 sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( |
76 navigations, profile); | 76 navigations, profile); |
77 | 77 |
78 // Restore web contents with navigation history. | 78 // Restore web contents with navigation history. |
79 content::WebContents* web_contents = content::WebContents::Create( | 79 content::WebContents* web_contents = content::WebContents::Create( |
80 content::WebContents::CreateParams(profile)); | 80 content::WebContents::CreateParams(profile)); |
81 web_contents->GetController().Restore( | 81 web_contents->GetController().Restore( |
82 selected_navigation, | 82 selected_navigation, content::RestoreType::CURRENT_SESSION, &nav_entries); |
83 content::NavigationController::RESTORE_CURRENT_SESSION, | |
84 &nav_entries); | |
85 | 83 |
86 // Create new tab. | 84 // Create new tab. |
87 tab_model_->CreateTab(nullptr, web_contents, -1); | 85 tab_model_->CreateTab(nullptr, web_contents, -1); |
88 return sessions::ContentLiveTab::GetForWebContents(web_contents); | 86 return sessions::ContentLiveTab::GetForWebContents(web_contents); |
89 } | 87 } |
90 | 88 |
91 // Currently does nothing. | 89 // Currently does nothing. |
92 sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab( | 90 sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab( |
93 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 91 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
94 int selected_navigation, | 92 int selected_navigation, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { | 127 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { |
130 TabModel* model = *it; | 128 TabModel* model = *it; |
131 if (!model->IsOffTheRecord()) { | 129 if (!model->IsOffTheRecord()) { |
132 return model->GetLiveTabContext(); | 130 return model->GetLiveTabContext(); |
133 } | 131 } |
134 } | 132 } |
135 } | 133 } |
136 | 134 |
137 return tab_model ? tab_model->GetLiveTabContext() : nullptr; | 135 return tab_model ? tab_model->GetLiveTabContext() : nullptr; |
138 } | 136 } |
OLD | NEW |