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

Unified Diff: chrome/browser/ui/browser_live_tab_context.cc

Issue 2868983003: Ensure History > Recent Tabs restore preserves window disposition. (Closed)
Patch Set: Remove NOTREACHED(). Created 3 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: chrome/browser/ui/browser_live_tab_context.cc
diff --git a/chrome/browser/ui/browser_live_tab_context.cc b/chrome/browser/ui/browser_live_tab_context.cc
index 6b679473328132d8fe32f3e78c93227552c50cd3..ab40ee226bbb6e469c3f0c750735b2bf4d93f39c 100644
--- a/chrome/browser/ui/browser_live_tab_context.cc
+++ b/chrome/browser/ui/browser_live_tab_context.cc
@@ -57,6 +57,18 @@ bool BrowserLiveTabContext::IsTabPinned(int index) const {
return browser_->tab_strip_model()->IsTabPinned(index);
}
+const gfx::Rect BrowserLiveTabContext::GetRestoredBounds() const {
+ return browser_->window()->GetRestoredBounds();
+}
+
+ui::WindowShowState BrowserLiveTabContext::GetRestoredState() const {
+ return browser_->window()->GetRestoredState();
+}
+
+std::string BrowserLiveTabContext::GetWorkspace() const {
+ return browser_->window()->GetWorkspace();
+}
+
sessions::LiveTab* BrowserLiveTabContext::AddRestoredTab(
const std::vector<sessions::SerializedNavigationEntry>& navigations,
int tab_index,
@@ -129,19 +141,26 @@ void BrowserLiveTabContext::CloseTab() {
// static
sessions::LiveTabContext* BrowserLiveTabContext::Create(
Profile* profile,
- const std::string& app_name) {
- Browser* browser;
+ const std::string& app_name,
+ const gfx::Rect& bounds,
+ ui::WindowShowState show_state,
+ const std::string& workspace) {
+ std::unique_ptr<Browser::CreateParams> create_params;
if (app_name.empty()) {
- browser = new Browser(Browser::CreateParams(profile, true));
+ create_params = base::MakeUnique<Browser::CreateParams>(
+ Browser::CreateParams(profile, true));
+ create_params->initial_bounds = bounds;
} else {
// Only trusted app popup windows should ever be restored.
- browser = new Browser(Browser::CreateParams::CreateForApp(
- app_name, true /* trusted_source */, gfx::Rect(), profile, true));
+ create_params = base::MakeUnique<Browser::CreateParams>(
+ Browser::CreateParams::CreateForApp(app_name, true /* trusted_source */,
+ bounds, profile,
+ true /* user_gesture */));
}
- if (browser)
- return browser->live_tab_context();
- else
- return NULL;
+ create_params->initial_show_state = show_state;
+ create_params->initial_workspace = workspace;
+ Browser* browser = new Browser(*create_params.get());
+ return browser->live_tab_context();
}
// static
« no previous file with comments | « chrome/browser/ui/browser_live_tab_context.h ('k') | chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698