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 25 matching lines...) Expand all Loading... |
36 content::WebContents* new_web_contents = content::WebContents::Create( | 36 content::WebContents* new_web_contents = content::WebContents::Create( |
37 content::WebContents::CreateParams(context)); | 37 content::WebContents::CreateParams(context)); |
38 int selected_index = session_tab.normalized_navigation_index(); | 38 int selected_index = session_tab.normalized_navigation_index(); |
39 new_web_contents->GetController().Restore( | 39 new_web_contents->GetController().Restore( |
40 selected_index, | 40 selected_index, |
41 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 41 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
42 &entries); | 42 &entries); |
43 | 43 |
44 TabAndroid* current_tab = TabAndroid::FromWebContents(web_contents); | 44 TabAndroid* current_tab = TabAndroid::FromWebContents(web_contents); |
45 DCHECK(current_tab); | 45 DCHECK(current_tab); |
46 if (disposition == CURRENT_TAB) { | 46 if (disposition == WindowOpenDisposition::CURRENT_TAB) { |
47 current_tab->SwapTabContents(web_contents, new_web_contents, false, false); | 47 current_tab->SwapTabContents(web_contents, new_web_contents, false, false); |
48 delete web_contents; | 48 delete web_contents; |
49 } else { | 49 } else { |
50 DCHECK(disposition == NEW_FOREGROUND_TAB || | 50 DCHECK(disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || |
51 disposition == NEW_BACKGROUND_TAB); | 51 disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB); |
52 tab_model->CreateTab(current_tab, new_web_contents, | 52 tab_model->CreateTab(current_tab, new_web_contents, |
53 current_tab->GetAndroidId()); | 53 current_tab->GetAndroidId()); |
54 } | 54 } |
55 return new_web_contents; | 55 return new_web_contents; |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows( | 59 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows( |
60 Profile* profile, | 60 Profile* profile, |
61 std::vector<const sessions::SessionWindow*>::const_iterator begin, | 61 std::vector<const sessions::SessionWindow*>::const_iterator begin, |
62 std::vector<const sessions::SessionWindow*>::const_iterator end) { | 62 std::vector<const sessions::SessionWindow*>::const_iterator end) { |
63 NOTREACHED(); | 63 NOTREACHED(); |
64 return std::vector<Browser*>(); | 64 return std::vector<Browser*>(); |
65 } | 65 } |
OLD | NEW |