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/safe_browsing/safe_browsing_util.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
8 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/safe_browsing/chunk.pb.h" | 11 #include "chrome/browser/safe_browsing/chunk.pb.h" |
10 #include "components/google/core/browser/google_util.h" | 12 #include "components/google/core/browser/google_util.h" |
11 | 13 |
12 namespace safe_browsing { | 14 namespace safe_browsing { |
13 | 15 |
14 // SBChunkData ----------------------------------------------------------------- | 16 // SBChunkData ----------------------------------------------------------------- |
15 | 17 |
16 // TODO(shess): Right now this contains a scoped_ptr<ChunkData> so that the | 18 // TODO(shess): Right now this contains a scoped_ptr<ChunkData> so that the |
17 // proto buffer isn't copied all over the place, then these are contained in a | 19 // proto buffer isn't copied all over the place, then these are contained in a |
18 // ScopedVector for purposes of passing things around between tasks. This seems | 20 // ScopedVector for purposes of passing things around between tasks. This seems |
19 // convoluted. Maybe it would make sense to have an overall container class | 21 // convoluted. Maybe it would make sense to have an overall container class |
20 // returning references to a nested per-chunk class? | 22 // returning references to a nested per-chunk class? |
21 | 23 |
22 SBChunkData::SBChunkData() { | 24 SBChunkData::SBChunkData() { |
23 } | 25 } |
24 | 26 |
25 SBChunkData::SBChunkData(scoped_ptr<ChunkData> data) | 27 SBChunkData::SBChunkData(scoped_ptr<ChunkData> data) |
26 : chunk_data_(data.Pass()) { | 28 : chunk_data_(std::move(data)) { |
27 DCHECK(chunk_data_.get()); | 29 DCHECK(chunk_data_.get()); |
28 } | 30 } |
29 | 31 |
30 SBChunkData::~SBChunkData() { | 32 SBChunkData::~SBChunkData() { |
31 } | 33 } |
32 | 34 |
33 bool SBChunkData::ParseFrom(const unsigned char* data, size_t length) { | 35 bool SBChunkData::ParseFrom(const unsigned char* data, size_t length) { |
34 scoped_ptr<ChunkData> chunk(new ChunkData()); | 36 scoped_ptr<ChunkData> chunk(new ChunkData()); |
35 if (!chunk->ParseFromArray(data, length)) | 37 if (!chunk->ParseFromArray(data, length)) |
36 return false; | 38 return false; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 : name(n) { | 127 : name(n) { |
126 } | 128 } |
127 | 129 |
128 // SBChunkDelete --------------------------------------------------------------- | 130 // SBChunkDelete --------------------------------------------------------------- |
129 | 131 |
130 SBChunkDelete::SBChunkDelete() : is_sub_del(false) {} | 132 SBChunkDelete::SBChunkDelete() : is_sub_del(false) {} |
131 | 133 |
132 SBChunkDelete::~SBChunkDelete() {} | 134 SBChunkDelete::~SBChunkDelete() {} |
133 | 135 |
134 } // namespace safe_browsing | 136 } // namespace safe_browsing |
OLD | NEW |