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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
827 if (browser->window()->GetRestoredWorkspace() != -1) { | |
sky
2016/05/02 15:11:23
I wouldn't bother checking the return value, alway
Tom (Use chromium acct)
2016/05/02 20:32:37
Done.
| |
828 sessions::CreateSetWindowWorkspaceCommand( | |
829 browser->session_id(), | |
830 browser->window()->GetRestoredWorkspace()); | |
831 } | |
832 | |
818 windows_to_track->insert(browser->session_id().id()); | 833 windows_to_track->insert(browser->session_id().id()); |
819 TabStripModel* tab_strip = browser->tab_strip_model(); | 834 TabStripModel* tab_strip = browser->tab_strip_model(); |
820 for (int i = 0; i < tab_strip->count(); ++i) { | 835 for (int i = 0; i < tab_strip->count(); ++i) { |
821 WebContents* tab = tab_strip->GetWebContentsAt(i); | 836 WebContents* tab = tab_strip->GetWebContentsAt(i); |
822 DCHECK(tab); | 837 DCHECK(tab); |
823 BuildCommandsForTab(browser->session_id(), | 838 BuildCommandsForTab(browser->session_id(), |
824 tab, | 839 tab, |
825 i, | 840 i, |
826 tab_strip->IsTabPinned(i), | 841 tab_strip->IsTabPinned(i), |
827 tab_to_available_range); | 842 tab_to_available_range); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1084 for (auto* browser : *BrowserList::GetInstance()) { | 1099 for (auto* browser : *BrowserList::GetInstance()) { |
1085 if (browser->profile() == profile()) | 1100 if (browser->profile() == profile()) |
1086 return; | 1101 return; |
1087 } | 1102 } |
1088 DeleteSessionOnlyData(profile()); | 1103 DeleteSessionOnlyData(profile()); |
1089 } | 1104 } |
1090 | 1105 |
1091 sessions::BaseSessionService* SessionService::GetBaseSessionServiceForTest() { | 1106 sessions::BaseSessionService* SessionService::GetBaseSessionServiceForTest() { |
1092 return base_session_service_.get(); | 1107 return base_session_service_.get(); |
1093 } | 1108 } |
OLD | NEW |