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/sessions/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/android/tab_android.h" | 9 #include "chrome/browser/android/tab_android.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 sessions::SerializedNavigationEntry::ToNavigationEntries( | 32 sessions::SerializedNavigationEntry::ToNavigationEntries( |
33 session_tab.navigations, profile); | 33 session_tab.navigations, profile); |
34 content::WebContents* new_web_contents = content::WebContents::Create( | 34 content::WebContents* new_web_contents = content::WebContents::Create( |
35 content::WebContents::CreateParams(context)); | 35 content::WebContents::CreateParams(context)); |
36 int selected_index = session_tab.normalized_navigation_index(); | 36 int selected_index = session_tab.normalized_navigation_index(); |
37 new_web_contents->GetController().Restore( | 37 new_web_contents->GetController().Restore( |
38 selected_index, | 38 selected_index, |
39 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 39 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
40 &entries); | 40 &entries); |
41 | 41 |
| 42 TabAndroid* current_tab = TabAndroid::FromWebContents(web_contents); |
| 43 DCHECK(current_tab); |
42 if (disposition == CURRENT_TAB) { | 44 if (disposition == CURRENT_TAB) { |
43 TabAndroid* current_tab = TabAndroid::FromWebContents(web_contents); | |
44 DCHECK(current_tab); | |
45 current_tab->SwapTabContents(web_contents, new_web_contents); | 45 current_tab->SwapTabContents(web_contents, new_web_contents); |
46 delete web_contents; | 46 delete web_contents; |
47 } else { | 47 } else { |
48 DCHECK(disposition == NEW_FOREGROUND_TAB || | 48 DCHECK(disposition == NEW_FOREGROUND_TAB || |
49 disposition == NEW_BACKGROUND_TAB); | 49 disposition == NEW_BACKGROUND_TAB); |
50 tab_model->CreateTab(new_web_contents); | 50 tab_model->CreateTab(new_web_contents, current_tab->GetAndroidId()); |
51 } | 51 } |
52 return new_web_contents; | 52 return new_web_contents; |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows( | 56 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows( |
57 Profile* profile, | 57 Profile* profile, |
58 chrome::HostDesktopType host_desktop_type, | 58 chrome::HostDesktopType host_desktop_type, |
59 std::vector<const SessionWindow*>::const_iterator begin, | 59 std::vector<const SessionWindow*>::const_iterator begin, |
60 std::vector<const SessionWindow*>::const_iterator end) { | 60 std::vector<const SessionWindow*>::const_iterator end) { |
61 NOTREACHED(); | 61 NOTREACHED(); |
62 return std::vector<Browser*>(); | 62 return std::vector<Browser*>(); |
63 } | 63 } |
OLD | NEW |