| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sessions/base_session_service_commands.h" | 5 #include "components/sessions/base_session_service_commands.h" |
| 6 | 6 |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "components/sessions/session_backend.h" | 8 #include "components/sessions/session_backend.h" |
| 9 #include "components/sessions/session_types.h" | 9 #include "components/sessions/session_types.h" |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool RestoreUpdateTabNavigationCommand( | 104 bool RestoreUpdateTabNavigationCommand( |
| 105 const SessionCommand& command, | 105 const SessionCommand& command, |
| 106 sessions::SerializedNavigationEntry* navigation, | 106 sessions::SerializedNavigationEntry* navigation, |
| 107 SessionID::id_type* tab_id) { | 107 SessionID::id_type* tab_id) { |
| 108 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 108 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
| 109 if (!pickle.get()) | 109 if (!pickle.get()) |
| 110 return false; | 110 return false; |
| 111 PickleIterator iterator(*pickle); | 111 PickleIterator iterator(*pickle); |
| 112 return pickle->ReadInt(&iterator, tab_id) && | 112 return iterator.ReadInt(tab_id) && navigation->ReadFromPickle(&iterator); |
| 113 navigation->ReadFromPickle(&iterator); | |
| 114 } | 113 } |
| 115 | 114 |
| 116 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, | 115 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, |
| 117 SessionID::id_type* tab_id, | 116 SessionID::id_type* tab_id, |
| 118 std::string* extension_app_id) { | 117 std::string* extension_app_id) { |
| 119 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 118 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
| 120 if (!pickle.get()) | 119 if (!pickle.get()) |
| 121 return false; | 120 return false; |
| 122 | 121 |
| 123 PickleIterator iterator(*pickle); | 122 PickleIterator iterator(*pickle); |
| 124 return pickle->ReadInt(&iterator, tab_id) && | 123 return iterator.ReadInt(tab_id) && iterator.ReadString(extension_app_id); |
| 125 pickle->ReadString(&iterator, extension_app_id); | |
| 126 } | 124 } |
| 127 | 125 |
| 128 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, | 126 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, |
| 129 SessionID::id_type* tab_id, | 127 SessionID::id_type* tab_id, |
| 130 std::string* user_agent_override) { | 128 std::string* user_agent_override) { |
| 131 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 129 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
| 132 if (!pickle.get()) | 130 if (!pickle.get()) |
| 133 return false; | 131 return false; |
| 134 | 132 |
| 135 PickleIterator iterator(*pickle); | 133 PickleIterator iterator(*pickle); |
| 136 return pickle->ReadInt(&iterator, tab_id) && | 134 return iterator.ReadInt(tab_id) && iterator.ReadString(user_agent_override); |
| 137 pickle->ReadString(&iterator, user_agent_override); | |
| 138 } | 135 } |
| 139 | 136 |
| 140 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, | 137 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, |
| 141 SessionID::id_type* window_id, | 138 SessionID::id_type* window_id, |
| 142 std::string* app_name) { | 139 std::string* app_name) { |
| 143 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 140 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
| 144 if (!pickle.get()) | 141 if (!pickle.get()) |
| 145 return false; | 142 return false; |
| 146 | 143 |
| 147 PickleIterator iterator(*pickle); | 144 PickleIterator iterator(*pickle); |
| 148 return pickle->ReadInt(&iterator, window_id) && | 145 return iterator.ReadInt(window_id) && iterator.ReadString(app_name); |
| 149 pickle->ReadString(&iterator, app_name); | |
| 150 } | 146 } |
| 151 | 147 |
| 152 } // namespace sessions | 148 } // namespace sessions |
| OLD | NEW |