Chromium Code Reviews| Index: components/sessions/core/session_service_commands.cc |
| diff --git a/components/sessions/core/session_service_commands.cc b/components/sessions/core/session_service_commands.cc |
| index 5d3cbf4ddc3b6818b54c148e234c7aa56cb9ca68..91852f69a04fcc1c62cbe82f6c703f48b3fefbde 100644 |
| --- a/components/sessions/core/session_service_commands.cc |
| +++ b/components/sessions/core/session_service_commands.cc |
| @@ -42,6 +42,7 @@ static const SessionCommand::id_type kCommandSetTabUserAgentOverride = 18; |
| static const SessionCommand::id_type kCommandSessionStorageAssociated = 19; |
| static const SessionCommand::id_type kCommandSetActiveWindow = 20; |
| static const SessionCommand::id_type kCommandLastActiveTime = 21; |
| +static const SessionCommand::id_type kCommandSetWindowWorkspace = 22; |
| namespace { |
| @@ -88,6 +89,8 @@ typedef IDAndIndexPayload WindowTypePayload; |
| typedef IDAndIndexPayload TabNavigationPathPrunedFromFrontPayload; |
| +typedef IDAndIndexPayload SetWindowWorkspacePayload; |
| + |
| struct PinnedStatePayload { |
| SessionID::id_type tab_id; |
| bool pinned_state; |
| @@ -580,6 +583,16 @@ bool CreateTabsAndWindows(const ScopedVector<SessionCommand>& data, |
| break; |
| } |
| + case kCommandSetWindowWorkspace: { |
| + SetWindowWorkspacePayload payload; |
| + if(!command->GetPayload(&payload, sizeof(payload))) { |
|
sky
2016/04/29 17:05:45
nit: space between 'if' and '('.
Tom (Use chromium acct)
2016/04/29 19:14:03
Done.
|
| + DVLOG(1) << "Failed reading command " << command->id(); |
| + return true; |
| + } |
| + GetWindow(payload.id, windows)->workspace_id = payload.index; |
| + break; |
| + } |
| + |
| default: |
| // TODO(skuhne): This might call back into a callback handler to extend |
| // the command set for specific implementations. |
| @@ -739,6 +752,18 @@ std::unique_ptr<SessionCommand> CreateLastActiveTimeCommand( |
| return command; |
| } |
| +std::unique_ptr<SessionCommand> CreateSetWindowWorkspaceCommand( |
| + const SessionID& window_id, |
| + int current_desktop) { |
| + SetWindowWorkspacePayload payload = {0}; |
| + payload.id = window_id.id(); |
| + payload.index = current_desktop; |
| + std::unique_ptr<SessionCommand> command( |
| + new SessionCommand(kCommandSetWindowWorkspace, sizeof(payload))); |
| + memcpy(command->contents(), &payload, sizeof(payload)); |
| + return command; |
| +} |
| + |
| std::unique_ptr<SessionCommand> CreateTabNavigationPathPrunedFromBackCommand( |
| const SessionID& tab_id, |
| int count) { |