| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/user_script.h" | 5 #include "extensions/common/user_script.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 uint32_t num_files = 0; | 281 uint32_t num_files = 0; |
| 282 CHECK(iter->ReadUInt32(&num_files)); | 282 CHECK(iter->ReadUInt32(&num_files)); |
| 283 scripts->clear(); | 283 scripts->clear(); |
| 284 for (uint32_t i = 0; i < num_files; ++i) { | 284 for (uint32_t i = 0; i < num_files; ++i) { |
| 285 File file; | 285 File file; |
| 286 file.Unpickle(pickle, iter); | 286 file.Unpickle(pickle, iter); |
| 287 scripts->push_back(file); | 287 scripts->push_back(file); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 UserScriptIDPair::UserScriptIDPair(int id, const HostID& host_id) |
| 292 : id(id), host_id(host_id) {} |
| 293 |
| 294 UserScriptIDPair::UserScriptIDPair(int id) : id(id), host_id(HostID()) {} |
| 295 |
| 296 bool operator<(const UserScriptIDPair& a, const UserScriptIDPair& b) { |
| 297 return a.id < b.id; |
| 298 } |
| 299 |
| 291 bool operator<(const UserScript& script1, const UserScript& script2) { | 300 bool operator<(const UserScript& script1, const UserScript& script2) { |
| 292 // The only kind of script that should be compared is the kind that has its | 301 // The only kind of script that should be compared is the kind that has its |
| 293 // IDs initialized to a meaningful value. | 302 // IDs initialized to a meaningful value. |
| 294 DCHECK(script1.id() != -1 && script2.id() != -1); | 303 DCHECK(script1.id() != -1 && script2.id() != -1); |
| 295 return script1.id() < script2.id(); | 304 return script1.id() < script2.id(); |
| 296 } | 305 } |
| 297 | 306 |
| 298 } // namespace extensions | 307 } // namespace extensions |
| OLD | NEW |