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

Unified Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/sessions/chrome_tab_restore_service_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/sessions/sessions_api.cc
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc
index 3d2e81304b6d3eacd16484dc2e929cd861f77663..5d3ddae4ebd3cd8ded427fadeb2a68a9d71d7eac 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
+#include "components/sessions/content/content_live_tab.h"
#include "components/sync_driver/glue/synced_session.h"
#include "components/sync_driver/open_tabs_ui_delegate.h"
#include "components/url_formatter/url_formatter.h"
@@ -454,16 +455,18 @@ bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) {
TabRestoreServiceDelegate* delegate =
BrowserTabRestoreServiceDelegate::FindDelegateForWebContents(
browser->tab_strip_model()->GetActiveWebContents());
- std::vector<content::WebContents*> contents =
+ std::vector<sessions::LiveTab*> restored_tabs =
tab_restore_service->RestoreMostRecentEntry(delegate, host_desktop_type);
- DCHECK(contents.size());
+ DCHECK(restored_tabs.size());
+ sessions::ContentLiveTab* first_tab =
+ static_cast<sessions::ContentLiveTab*>(restored_tabs[0]);
if (is_window) {
return SetResultRestoredWindow(
- ExtensionTabUtil::GetWindowIdOfTab(contents[0]));
+ ExtensionTabUtil::GetWindowIdOfTab(first_tab->web_contents()));
}
- SetResultRestoredTab(contents[0]);
+ SetResultRestoredTab(first_tab->web_contents());
return true;
}
@@ -494,24 +497,25 @@ bool SessionsRestoreFunction::RestoreLocalSession(const SessionId& session_id,
TabRestoreServiceDelegate* delegate =
BrowserTabRestoreServiceDelegate::FindDelegateForWebContents(
browser->tab_strip_model()->GetActiveWebContents());
- std::vector<content::WebContents*> contents =
- tab_restore_service->RestoreEntryById(delegate,
- session_id.id(),
- host_desktop_type,
- UNKNOWN);
- // If the ID is invalid, contents will be empty.
- if (!contents.size()) {
+ std::vector<sessions::LiveTab*> restored_tabs =
+ tab_restore_service->RestoreEntryById(delegate, session_id.id(),
+ host_desktop_type, UNKNOWN);
+ // If the ID is invalid, restored_tabs will be empty.
+ if (!restored_tabs.size()) {
SetInvalidIdError(session_id.ToString());
return false;
}
- // Retrieve the window through any of the tabs in contents.
+ sessions::ContentLiveTab* first_tab =
+ static_cast<sessions::ContentLiveTab*>(restored_tabs[0]);
+
+ // Retrieve the window through any of the tabs in restored_tabs.
if (is_window) {
return SetResultRestoredWindow(
- ExtensionTabUtil::GetWindowIdOfTab(contents[0]));
+ ExtensionTabUtil::GetWindowIdOfTab(first_tab->web_contents()));
}
- SetResultRestoredTab(contents[0]);
+ SetResultRestoredTab(first_tab->web_contents());
return true;
}
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/sessions/chrome_tab_restore_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698