Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/sessions/session_restore_android.cc

Issue 14497003: Moves TabNavigation into components/sessions and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really remove webkit_support Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sessions/session_types.h" 8 #include "chrome/browser/sessions/session_types.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/android/tab_model/tab_model.h" 11 #include "chrome/browser/ui/android/tab_model/tab_model.h"
12 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 12 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
13 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 15
16 // The android implementation does not do anything "foreign session" specific. 16 // The android implementation does not do anything "foreign session" specific.
17 // We use it to restore tabs from "recently closed" too. 17 // We use it to restore tabs from "recently closed" too.
18 // static 18 // static
19 void SessionRestore::RestoreForeignSessionTab( 19 void SessionRestore::RestoreForeignSessionTab(
20 content::WebContents* web_contents, 20 content::WebContents* web_contents,
21 const SessionTab& session_tab, 21 const SessionTab& session_tab,
22 WindowOpenDisposition disposition) { 22 WindowOpenDisposition disposition) {
23 DCHECK(session_tab.navigations.size() > 0); 23 DCHECK(session_tab.navigations.size() > 0);
24 content::BrowserContext* context = web_contents->GetBrowserContext(); 24 content::BrowserContext* context = web_contents->GetBrowserContext();
25 Profile* profile = Profile::FromBrowserContext(context); 25 Profile* profile = Profile::FromBrowserContext(context);
26 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile); 26 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile);
27 DCHECK(tab_model); 27 DCHECK(tab_model);
28 std::vector<content::NavigationEntry*> entries = 28 std::vector<content::NavigationEntry*> entries =
29 TabNavigation::CreateNavigationEntriesFromTabNavigations( 29 sessions::SerializedNavigationEntry::ToNavigationEntries(
30 session_tab.navigations, profile); 30 session_tab.navigations, profile);
31 content::WebContents* new_web_contents = content::WebContents::Create( 31 content::WebContents* new_web_contents = content::WebContents::Create(
32 content::WebContents::CreateParams(context)); 32 content::WebContents::CreateParams(context));
33 int selected_index = session_tab.normalized_navigation_index(); 33 int selected_index = session_tab.normalized_navigation_index();
34 new_web_contents->GetController().Restore( 34 new_web_contents->GetController().Restore(
35 selected_index, 35 selected_index,
36 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, 36 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
37 &entries); 37 &entries);
38 tab_model->CreateTab(new_web_contents); 38 tab_model->CreateTab(new_web_contents);
39 } 39 }
40 40
41 // static 41 // static
42 void SessionRestore::RestoreForeignSessionWindows( 42 void SessionRestore::RestoreForeignSessionWindows(
43 Profile* profile, 43 Profile* profile,
44 chrome::HostDesktopType host_desktop_type, 44 chrome::HostDesktopType host_desktop_type,
45 std::vector<const SessionWindow*>::const_iterator begin, 45 std::vector<const SessionWindow*>::const_iterator begin,
46 std::vector<const SessionWindow*>::const_iterator end) { 46 std::vector<const SessionWindow*>::const_iterator end) {
47 NOTREACHED(); 47 NOTREACHED();
48 } 48 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_command.h ('k') | chrome/browser/sessions/session_restore_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698