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 iterator.ReadInt(tab_id) && navigation->ReadFromPickle(&iterator); | 112 return pickle->ReadInt(&iterator, tab_id) && |
| 113 navigation->ReadFromPickle(&iterator); |
113 } | 114 } |
114 | 115 |
115 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, | 116 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, |
116 SessionID::id_type* tab_id, | 117 SessionID::id_type* tab_id, |
117 std::string* extension_app_id) { | 118 std::string* extension_app_id) { |
118 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 119 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
119 if (!pickle.get()) | 120 if (!pickle.get()) |
120 return false; | 121 return false; |
121 | 122 |
122 PickleIterator iterator(*pickle); | 123 PickleIterator iterator(*pickle); |
123 return iterator.ReadInt(tab_id) && iterator.ReadString(extension_app_id); | 124 return pickle->ReadInt(&iterator, tab_id) && |
| 125 pickle->ReadString(&iterator, extension_app_id); |
124 } | 126 } |
125 | 127 |
126 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, | 128 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, |
127 SessionID::id_type* tab_id, | 129 SessionID::id_type* tab_id, |
128 std::string* user_agent_override) { | 130 std::string* user_agent_override) { |
129 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 131 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
130 if (!pickle.get()) | 132 if (!pickle.get()) |
131 return false; | 133 return false; |
132 | 134 |
133 PickleIterator iterator(*pickle); | 135 PickleIterator iterator(*pickle); |
134 return iterator.ReadInt(tab_id) && iterator.ReadString(user_agent_override); | 136 return pickle->ReadInt(&iterator, tab_id) && |
| 137 pickle->ReadString(&iterator, user_agent_override); |
135 } | 138 } |
136 | 139 |
137 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, | 140 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, |
138 SessionID::id_type* window_id, | 141 SessionID::id_type* window_id, |
139 std::string* app_name) { | 142 std::string* app_name) { |
140 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); | 143 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); |
141 if (!pickle.get()) | 144 if (!pickle.get()) |
142 return false; | 145 return false; |
143 | 146 |
144 PickleIterator iterator(*pickle); | 147 PickleIterator iterator(*pickle); |
145 return iterator.ReadInt(window_id) && iterator.ReadString(app_name); | 148 return pickle->ReadInt(&iterator, window_id) && |
| 149 pickle->ReadString(&iterator, app_name); |
146 } | 150 } |
147 | 151 |
148 } // namespace sessions | 152 } // namespace sessions |
OLD | NEW |