| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/extensions/browser_action_drag_data.h" | 5 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 Profile* profile, Pickle* pickle) const { | 85 Profile* profile, Pickle* pickle) const { |
| 86 pickle->WriteBytes(&profile, sizeof(profile)); | 86 pickle->WriteBytes(&profile, sizeof(profile)); |
| 87 pickle->WriteString(id_); | 87 pickle->WriteString(id_); |
| 88 pickle->WriteUInt64(index_); | 88 pickle->WriteUInt64(index_); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { | 91 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { |
| 92 PickleIterator data_iterator(*pickle); | 92 PickleIterator data_iterator(*pickle); |
| 93 | 93 |
| 94 const char* tmp; | 94 const char* tmp; |
| 95 if (!data_iterator.ReadBytes(&tmp, sizeof(profile_))) | 95 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_))) |
| 96 return false; | 96 return false; |
| 97 memcpy(&profile_, tmp, sizeof(profile_)); | 97 memcpy(&profile_, tmp, sizeof(profile_)); |
| 98 | 98 |
| 99 if (!data_iterator.ReadString(&id_)) | 99 if (!pickle->ReadString(&data_iterator, &id_)) |
| 100 return false; | 100 return false; |
| 101 | 101 |
| 102 uint64 index; | 102 uint64 index; |
| 103 if (!data_iterator.ReadUInt64(&index)) | 103 if (!pickle->ReadUInt64(&data_iterator, &index)) |
| 104 return false; | 104 return false; |
| 105 index_ = static_cast<size_t>(index); | 105 index_ = static_cast<size_t>(index); |
| 106 | 106 |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| OLD | NEW |