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 bf3672f1434b3277730cb319bf9901ea4ce5e337..f2b6a730dabf398caae6cde9515eb012f3c3c775 100644 |
--- a/chrome/browser/ui/browser_live_tab_context.cc |
+++ b/chrome/browser/ui/browser_live_tab_context.cc |
@@ -57,6 +57,27 @@ bool BrowserLiveTabContext::IsTabPinned(int index) const { |
return browser_->tab_strip_model()->IsTabPinned(index); |
} |
+const gfx::Rect BrowserLiveTabContext::GetBounds() const { |
+ auto* window = browser_->window(); |
sky
2017/05/08 22:51:35
Please don't use auto* here. Using auto here reduc
chrisha
2017/05/09 15:44:54
Yeah, from what I can see window() should never be
|
+ if (window) |
+ return window->GetRestoredBounds(); |
+ return browser_->override_bounds(); |
+} |
+ |
+ui::WindowShowState BrowserLiveTabContext::GetShowState() const { |
+ auto* window = browser_->window(); |
+ if (window) |
+ return window->GetRestoredState(); |
+ return browser_->initial_show_state(); |
+} |
+ |
+std::string BrowserLiveTabContext::GetWorkspace() const { |
+ auto* window = browser_->window(); |
+ if (window) |
+ return window->GetWorkspace(); |
+ return browser_->initial_workspace(); |
+} |
+ |
sessions::LiveTab* BrowserLiveTabContext::AddRestoredTab( |
const std::vector<sessions::SerializedNavigationEntry>& navigations, |
int tab_index, |
@@ -127,19 +148,30 @@ void BrowserLiveTabContext::CloseTab() { |
// static |
sessions::LiveTabContext* BrowserLiveTabContext::Create( |
Profile* profile, |
- const std::string& app_name) { |
+ const std::string& app_name, |
+ const gfx::Rect& bounds, |
+ ui::WindowShowState show_state, |
+ const std::string& workspace) { |
Browser* browser; |
sky
2017/05/08 22:51:35
Move this to line 170 where it's used.
chrisha
2017/05/09 15:44:54
Done.
|
+ std::unique_ptr<Browser::CreateParams> create_params; |
if (app_name.empty()) { |
- browser = new Browser(Browser::CreateParams(profile, true)); |
+ create_params = std::make_unique<Browser::CreateParams>( |
sky
2017/05/08 22:51:35
MakeUnique? We're not using c++ 14 yet are we?
chrisha
2017/05/09 15:44:54
Oops, not yet :)
|
+ 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 = std::make_unique<Browser::CreateParams>( |
+ Browser::CreateParams::CreateForApp(app_name, true /* trusted_source */, |
+ bounds, profile, |
+ true /* user_gesture */)); |
} |
+ create_params->initial_show_state = show_state; |
+ create_params->initial_workspace = workspace; |
+ browser = new Browser(*create_params.get()); |
if (browser) |
sky
2017/05/08 22:51:35
|browser| should always be non-null.
chrisha
2017/05/09 15:44:54
Done.
|
return browser->live_tab_context(); |
- else |
- return NULL; |
+ |
+ return nullptr; |
} |
// static |