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

Unified Diff: components/sessions/core/tab_restore_service_helper.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/sessions/core/tab_restore_service_helper.cc
diff --git a/components/sessions/core/tab_restore_service_helper.cc b/components/sessions/core/tab_restore_service_helper.cc
index cc3f2ae80af6260108bdefebf3fcb4a74d5119bc..1390ba1f6edade9ef1face23552d615bbefb4300 100644
--- a/components/sessions/core/tab_restore_service_helper.cc
+++ b/components/sessions/core/tab_restore_service_helper.cc
@@ -129,7 +129,8 @@ std::vector<LiveTab*> TabRestoreServiceHelper::RestoreMostRecentEntry(
LiveTabContext* context) {
if (entries_.empty())
return std::vector<LiveTab*>();
- return RestoreEntryById(context, entries_.front()->id, UNKNOWN);
+ return RestoreEntryById(context, entries_.front()->id,
+ WindowOpenDisposition::UNKNOWN);
}
std::unique_ptr<TabRestoreService::Tab>
@@ -242,8 +243,8 @@ std::vector<LiveTab*> TabRestoreServiceHelper::RestoreEntryById(
}
context->ShowBrowserWindow();
- if (disposition == CURRENT_TAB && current_context &&
- current_context->GetActiveLiveTab()) {
+ if (disposition == WindowOpenDisposition::CURRENT_TAB &&
+ current_context && current_context->GetActiveLiveTab()) {
current_context->CloseTab();
}
break;
@@ -373,13 +374,13 @@ LiveTabContext* TabRestoreServiceHelper::RestoreTab(
WindowOpenDisposition disposition,
LiveTab** live_tab) {
LiveTab* restored_tab;
- if (disposition == CURRENT_TAB && context) {
+ if (disposition == WindowOpenDisposition::CURRENT_TAB && context) {
restored_tab = context->ReplaceRestoredTab(
tab.navigations, tab.current_navigation_index, tab.from_last_session,
tab.extension_app_id, tab.platform_data.get(), tab.user_agent_override);
} else {
// We only respsect the tab's original browser if there's no disposition.
- if (disposition == UNKNOWN && tab.browser_id) {
+ if (disposition == WindowOpenDisposition::UNKNOWN && tab.browser_id) {
context = client_->FindLiveTabContextWithID(tab.browser_id);
}
@@ -388,7 +389,7 @@ LiveTabContext* TabRestoreServiceHelper::RestoreTab(
// |context| will be NULL in cases where one isn't already available (eg,
// when invoked on Mac OS X with no windows open). In this case, create a
// new browser into which we restore the tabs.
- if (context && disposition != NEW_WINDOW) {
+ if (context && disposition != WindowOpenDisposition::NEW_WINDOW) {
tab_index = tab.tabstrip_index;
} else {
context = client_->CreateLiveTabContext(std::string());
@@ -399,13 +400,14 @@ LiveTabContext* TabRestoreServiceHelper::RestoreTab(
// Place the tab at the end if the tab index is no longer valid or
// we were passed a specific disposition.
if (tab_index < 0 || tab_index > context->GetTabCount() ||
- disposition != UNKNOWN) {
+ disposition != WindowOpenDisposition::UNKNOWN) {
tab_index = context->GetTabCount();
}
restored_tab = context->AddRestoredTab(
tab.navigations, tab_index, tab.current_navigation_index,
- tab.extension_app_id, disposition != NEW_BACKGROUND_TAB, tab.pinned,
+ tab.extension_app_id,
+ disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB, tab.pinned,
tab.from_last_session, tab.platform_data.get(),
tab.user_agent_override);
restored_tab->LoadIfNecessary();

Powered by Google App Engine
This is Rietveld 408576698