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

Side by Side Diff: chrome/browser/ui/browser_tabrestore.cc

Issue 2225343002: Navigation: move RestoreType and ReloadType into a separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [rebase] Created 4 years, 3 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
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/ui/browser_tabrestore.h" 5 #include "chrome/browser/ui/browser_tabrestore.h"
6 6
7 #include "chrome/browser/extensions/tab_helper.h" 7 #include "chrome/browser/extensions/tab_helper.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_service.h" 9 #include "chrome/browser/sessions/session_service.h"
10 #include "chrome/browser/sessions/session_service_factory.h" 10 #include "chrome/browser/sessions/session_service_factory.h"
11 #include "chrome/browser/tab_contents/tab_util.h" 11 #include "chrome/browser/tab_contents/tab_util.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/web_contents_sizer.h" 15 #include "chrome/browser/ui/web_contents_sizer.h"
16 #include "components/sessions/content/content_serialized_navigation_builder.h" 16 #include "components/sessions/content/content_serialized_navigation_builder.h"
17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/restore_type.h"
19 #include "content/public/browser/session_storage_namespace.h" 19 #include "content/public/browser/session_storage_namespace.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 21
22 using content::RestoreType;
22 using content::WebContents; 23 using content::WebContents;
23 using content::NavigationController;
24 using content::NavigationEntry; 24 using content::NavigationEntry;
25 using sessions::ContentSerializedNavigationBuilder; 25 using sessions::ContentSerializedNavigationBuilder;
26 using sessions::SerializedNavigationEntry; 26 using sessions::SerializedNavigationEntry;
27 27
28 namespace chrome { 28 namespace chrome {
29 29
30 namespace { 30 namespace {
31 31
32 NavigationController::RestoreType GetRestoreType(Browser* browser, 32 RestoreType GetRestoreType(Browser* browser, bool from_last_session) {
33 bool from_last_session) {
34 if (!from_last_session) 33 if (!from_last_session)
35 return NavigationController::RESTORE_CURRENT_SESSION; 34 return RestoreType::CURRENT_SESSION;
36 return browser->profile()->GetLastSessionExitType() == Profile::EXIT_CRASHED ? 35 return browser->profile()->GetLastSessionExitType() == Profile::EXIT_CRASHED
37 NavigationController::RESTORE_LAST_SESSION_CRASHED : 36 ? RestoreType::LAST_SESSION_CRASHED
38 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY; 37 : RestoreType::LAST_SESSION_EXITED_CLEANLY;
39 } 38 }
40 39
41 WebContents* CreateRestoredTab( 40 WebContents* CreateRestoredTab(
42 Browser* browser, 41 Browser* browser,
43 const std::vector<SerializedNavigationEntry>& navigations, 42 const std::vector<SerializedNavigationEntry>& navigations,
44 int selected_navigation, 43 int selected_navigation,
45 const std::string& extension_app_id, 44 const std::string& extension_app_id,
46 bool from_last_session, 45 bool from_last_session,
47 content::SessionStorageNamespace* session_storage_namespace, 46 content::SessionStorageNamespace* session_storage_namespace,
48 const std::string& user_agent_override, 47 const std::string& user_agent_override,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 int insertion_index = tab_strip->active_index(); 160 int insertion_index = tab_strip->active_index();
162 tab_strip->InsertWebContentsAt(insertion_index + 1, 161 tab_strip->InsertWebContentsAt(insertion_index + 1,
163 web_contents, 162 web_contents,
164 TabStripModel::ADD_ACTIVE | 163 TabStripModel::ADD_ACTIVE |
165 TabStripModel::ADD_INHERIT_GROUP); 164 TabStripModel::ADD_INHERIT_GROUP);
166 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); 165 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE);
167 return web_contents; 166 return web_contents;
168 } 167 }
169 168
170 } // namespace chrome 169 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698