| 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/core/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/core/session_backend.h" |
| 9 #include "components/sessions/session_types.h" | 9 #include "components/sessions/core/session_types.h" |
| 10 | 10 |
| 11 namespace sessions { | 11 namespace sessions { |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // Helper used by CreateUpdateTabNavigationCommand(). It writes |str| to | 14 // Helper used by CreateUpdateTabNavigationCommand(). It writes |str| to |
| 15 // |pickle|, if and only if |str| fits within (|max_bytes| - |*bytes_written|). | 15 // |pickle|, if and only if |str| fits within (|max_bytes| - |*bytes_written|). |
| 16 // |bytes_written| is incremented to reflect the data written. | 16 // |bytes_written| is incremented to reflect the data written. |
| 17 void WriteStringToPickle(base::Pickle& pickle, | 17 void WriteStringToPickle(base::Pickle& pickle, |
| 18 int* bytes_written, | 18 int* bytes_written, |
| 19 int max_bytes, | 19 int max_bytes, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 std::string* app_name) { | 141 std::string* app_name) { |
| 142 scoped_ptr<base::Pickle> pickle(command.PayloadAsPickle()); | 142 scoped_ptr<base::Pickle> pickle(command.PayloadAsPickle()); |
| 143 if (!pickle.get()) | 143 if (!pickle.get()) |
| 144 return false; | 144 return false; |
| 145 | 145 |
| 146 base::PickleIterator iterator(*pickle); | 146 base::PickleIterator iterator(*pickle); |
| 147 return iterator.ReadInt(window_id) && iterator.ReadString(app_name); | 147 return iterator.ReadInt(window_id) && iterator.ReadString(app_name); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace sessions | 150 } // namespace sessions |
| OLD | NEW |