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..d67898e2695b476dbb518ebe4b75ace26c7a3202 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))) { |
+ 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) { |