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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 BrowserActionDragData::kClipboardFormatString); | 60 BrowserActionDragData::kClipboardFormatString); |
61 } | 61 } |
62 return format; | 62 return format; |
63 } | 63 } |
64 #endif | 64 #endif |
65 | 65 |
66 void BrowserActionDragData::WriteToPickle( | 66 void BrowserActionDragData::WriteToPickle( |
67 Profile* profile, Pickle* pickle) const { | 67 Profile* profile, Pickle* pickle) const { |
68 pickle->WriteBytes(&profile, sizeof(profile)); | 68 pickle->WriteBytes(&profile, sizeof(profile)); |
69 pickle->WriteString(id_); | 69 pickle->WriteString(id_); |
70 pickle->WriteSize(index_); | 70 pickle->WriteUInt64(index_); |
71 } | 71 } |
72 | 72 |
73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { | 73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { |
74 PickleIterator data_iterator(*pickle); | 74 PickleIterator data_iterator(*pickle); |
75 | 75 |
76 const char* tmp; | 76 const char* tmp; |
77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_))) | 77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_))) |
78 return false; | 78 return false; |
79 memcpy(&profile_, tmp, sizeof(profile_)); | 79 memcpy(&profile_, tmp, sizeof(profile_)); |
80 | 80 |
81 if (!pickle->ReadString(&data_iterator, &id_)) | 81 if (!pickle->ReadString(&data_iterator, &id_)) |
82 return false; | 82 return false; |
83 | 83 |
84 if (!pickle->ReadSize(&data_iterator, &index_)) | 84 uint64 index; |
| 85 if (!pickle->ReadUInt64(&data_iterator, &index)) |
85 return false; | 86 return false; |
| 87 index_ = static_cast<size_t>(index); |
86 | 88 |
87 return true; | 89 return true; |
88 } | 90 } |
OLD | NEW |