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..ca02f49e881f7e068ee42901490e71e9a14fd882 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 { |
| @@ -580,6 +581,21 @@ bool CreateTabsAndWindows(const ScopedVector<SessionCommand>& data, |
| break; |
| } |
| + case kCommandSetWindowWorkspace: { |
| + std::unique_ptr<base::Pickle> pickle(command->PayloadAsPickle()); |
| + base::PickleIterator it(*pickle); |
| + const SessionID::id_type* window_id; |
| + std::string workspace; |
| + if (!it.ReadBytes(reinterpret_cast<const char**>(&window_id), |
|
sky
2016/05/06 17:43:09
Why do you reinterpret cast here? You should be ab
Tom (Use chromium acct)
2016/05/06 18:25:40
Done.
|
| + sizeof(*window_id)) || |
| + !it.ReadString(&workspace)) { |
| + DVLOG(1) << "Failed reading command " << command->id(); |
| + return true; |
| + } |
| + GetWindow(*window_id, windows)->workspace = workspace; |
| + break; |
| + } |
| + |
| default: |
| // TODO(skuhne): This might call back into a callback handler to extend |
| // the command set for specific implementations. |
| @@ -739,6 +755,18 @@ std::unique_ptr<SessionCommand> CreateLastActiveTimeCommand( |
| return command; |
| } |
| +std::unique_ptr<SessionCommand> CreateSetWindowWorkspaceCommand( |
| + const SessionID& window_id, |
| + const std::string& workspace) { |
| + base::Pickle pickle; |
| + pickle.WriteBytes(static_cast<const void*>(&window_id), sizeof(window_id)); |
|
sky
2016/05/06 17:43:09
Same comment here. Use WriteInt.
Tom (Use chromium acct)
2016/05/06 18:25:40
Done.
|
| + pickle.WriteString(workspace); |
| + std::unique_ptr<SessionCommand> command( |
| + new SessionCommand(kCommandSetWindowWorkspace, pickle.size())); |
|
sky
2016/05/06 17:43:09
Use the constructor that takes the pickle.
Tom (Use chromium acct)
2016/05/06 18:25:40
Done.
|
| + memcpy(command->contents(), pickle.data(), pickle.size()); |
| + return command; |
| +} |
| + |
| std::unique_ptr<SessionCommand> CreateTabNavigationPathPrunedFromBackCommand( |
| const SessionID& tab_id, |
| int count) { |