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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 navigations, profile); | 77 navigations, profile); |
78 | 78 |
79 // Restore web contents with navigation history. | 79 // Restore web contents with navigation history. |
80 content::WebContents* web_contents = content::WebContents::Create( | 80 content::WebContents* web_contents = content::WebContents::Create( |
81 content::WebContents::CreateParams(profile)); | 81 content::WebContents::CreateParams(profile)); |
82 web_contents->GetController().Restore( | 82 web_contents->GetController().Restore( |
83 selected_navigation, content::RestoreType::CURRENT_SESSION, &nav_entries); | 83 selected_navigation, content::RestoreType::CURRENT_SESSION, &nav_entries); |
84 | 84 |
85 // Create new tab. | 85 // Create new tab. |
86 tab_model_->CreateTab(nullptr, web_contents, -1); | 86 tab_model_->CreateTab(nullptr, web_contents, -1); |
| 87 web_contents->GetController().LoadIfNecessary(); |
87 return sessions::ContentLiveTab::GetForWebContents(web_contents); | 88 return sessions::ContentLiveTab::GetForWebContents(web_contents); |
88 } | 89 } |
89 | 90 |
90 // Currently does nothing. | 91 // Currently does nothing. |
91 sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab( | 92 sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab( |
92 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 93 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
93 int selected_navigation, | 94 int selected_navigation, |
94 bool from_last_session, | 95 bool from_last_session, |
95 const std::string& extension_app_id, | 96 const std::string& extension_app_id, |
96 const sessions::PlatformSpecificTabData* tab_platform_data, | 97 const sessions::PlatformSpecificTabData* tab_platform_data, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { | 129 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { |
129 TabModel* model = *it; | 130 TabModel* model = *it; |
130 if (!model->IsOffTheRecord()) { | 131 if (!model->IsOffTheRecord()) { |
131 return model->GetLiveTabContext(); | 132 return model->GetLiveTabContext(); |
132 } | 133 } |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
136 return tab_model ? tab_model->GetLiveTabContext() : nullptr; | 137 return tab_model ? tab_model->GetLiveTabContext() : nullptr; |
137 } | 138 } |
OLD | NEW |