Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/sessions/session_service.h" | 5 #include "chrome/browser/sessions/session_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 void SessionService::SetWindowBounds(const SessionID& window_id, | 162 void SessionService::SetWindowBounds(const SessionID& window_id, |
| 163 const gfx::Rect& bounds, | 163 const gfx::Rect& bounds, |
| 164 ui::WindowShowState show_state) { | 164 ui::WindowShowState show_state) { |
| 165 if (!ShouldTrackChangesToWindow(window_id)) | 165 if (!ShouldTrackChangesToWindow(window_id)) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 ScheduleCommand( | 168 ScheduleCommand( |
| 169 sessions::CreateSetWindowBoundsCommand(window_id, bounds, show_state)); | 169 sessions::CreateSetWindowBoundsCommand(window_id, bounds, show_state)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void SessionService::SetWindowWorkspace(const SessionID& window_id, | |
| 173 int workspace_id) { | |
| 174 if (!ShouldTrackChangesToWindow(window_id)) | |
| 175 return; | |
| 176 | |
| 177 ScheduleCommand( | |
| 178 sessions::CreateSetWindowWorkspaceCommand(window_id, workspace_id)); | |
| 179 } | |
| 180 | |
| 172 void SessionService::SetTabIndexInWindow(const SessionID& window_id, | 181 void SessionService::SetTabIndexInWindow(const SessionID& window_id, |
| 173 const SessionID& tab_id, | 182 const SessionID& tab_id, |
| 174 int new_index) { | 183 int new_index) { |
| 175 if (!ShouldTrackChangesToWindow(window_id)) | 184 if (!ShouldTrackChangesToWindow(window_id)) |
| 176 return; | 185 return; |
| 177 | 186 |
| 178 ScheduleCommand( | 187 ScheduleCommand( |
| 179 sessions::CreateSetTabIndexInWindowCommand(tab_id, new_index)); | 188 sessions::CreateSetTabIndexInWindowCommand(tab_id, new_index)); |
| 180 } | 189 } |
| 181 | 190 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 sessions::CreateSetWindowTypeCommand( | 816 sessions::CreateSetWindowTypeCommand( |
| 808 browser->session_id(), | 817 browser->session_id(), |
| 809 WindowTypeForBrowserType(browser->type()))); | 818 WindowTypeForBrowserType(browser->type()))); |
| 810 | 819 |
| 811 if (!browser->app_name().empty()) { | 820 if (!browser->app_name().empty()) { |
| 812 base_session_service_->AppendRebuildCommand( | 821 base_session_service_->AppendRebuildCommand( |
| 813 sessions::CreateSetWindowAppNameCommand( | 822 sessions::CreateSetWindowAppNameCommand( |
| 814 browser->session_id(), | 823 browser->session_id(), |
| 815 browser->app_name())); | 824 browser->app_name())); |
| 816 } | 825 } |
| 817 | 826 |
|
sky
2016/04/29 17:05:45
You'll need to save the workspace some where in th
Tom (Use chromium acct)
2016/04/29 19:14:03
Done. Although I had to add a lot of plumbing to
| |
| 818 windows_to_track->insert(browser->session_id().id()); | 827 windows_to_track->insert(browser->session_id().id()); |
| 819 TabStripModel* tab_strip = browser->tab_strip_model(); | 828 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 820 for (int i = 0; i < tab_strip->count(); ++i) { | 829 for (int i = 0; i < tab_strip->count(); ++i) { |
| 821 WebContents* tab = tab_strip->GetWebContentsAt(i); | 830 WebContents* tab = tab_strip->GetWebContentsAt(i); |
| 822 DCHECK(tab); | 831 DCHECK(tab); |
| 823 BuildCommandsForTab(browser->session_id(), | 832 BuildCommandsForTab(browser->session_id(), |
| 824 tab, | 833 tab, |
| 825 i, | 834 i, |
| 826 tab_strip->IsTabPinned(i), | 835 tab_strip->IsTabPinned(i), |
| 827 tab_to_available_range); | 836 tab_to_available_range); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1084 for (auto* browser : *BrowserList::GetInstance()) { | 1093 for (auto* browser : *BrowserList::GetInstance()) { |
| 1085 if (browser->profile() == profile()) | 1094 if (browser->profile() == profile()) |
| 1086 return; | 1095 return; |
| 1087 } | 1096 } |
| 1088 DeleteSessionOnlyData(profile()); | 1097 DeleteSessionOnlyData(profile()); |
| 1089 } | 1098 } |
| 1090 | 1099 |
| 1091 sessions::BaseSessionService* SessionService::GetBaseSessionServiceForTest() { | 1100 sessions::BaseSessionService* SessionService::GetBaseSessionServiceForTest() { |
| 1092 return base_session_service_.get(); | 1101 return base_session_service_.get(); |
| 1093 } | 1102 } |
| OLD | NEW |