Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1017)

Side by Side Diff: chrome/browser/safe_browsing/chunk_range.h

Issue 1420053005: Move code in components/safe_browsing_db and chrome/browser/s_b/ under the safe_browsing namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_components_move
Patch Set: Remove '// namespace safe_browsing' for a small fwd decl block. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Class for parsing lists of integers into ranges. 5 // Class for parsing lists of integers into ranges.
6 // 6 //
7 // The anti-phishing and anti-malware protocol sends ASCII strings of numbers 7 // The anti-phishing and anti-malware protocol sends ASCII strings of numbers
8 // and ranges of numbers corresponding to chunks of whitelists and blacklists. 8 // and ranges of numbers corresponding to chunks of whitelists and blacklists.
9 // Clients of this protocol need to be able to convert back and forth between 9 // Clients of this protocol need to be able to convert back and forth between
10 // this representation, and individual integer chunk numbers. The ChunkRange 10 // this representation, and individual integer chunk numbers. The ChunkRange
11 // class is a simple and compact mechanism for storing a continuous list of 11 // class is a simple and compact mechanism for storing a continuous list of
12 // chunk numbers. 12 // chunk numbers.
13 13
14 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_ 14 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_
15 #define CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_ 15 #define CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_
16 16
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 namespace safe_browsing {
21
20 // ChunkRange ------------------------------------------------------------------ 22 // ChunkRange ------------------------------------------------------------------
21 // Each ChunkRange represents a continuous range of chunk numbers [start, stop]. 23 // Each ChunkRange represents a continuous range of chunk numbers [start, stop].
22 24
23 class ChunkRange { 25 class ChunkRange {
24 public: 26 public:
25 explicit ChunkRange(int start); 27 explicit ChunkRange(int start);
26 ChunkRange(int start, int stop); 28 ChunkRange(int start, int stop);
27 ChunkRange(const ChunkRange& rhs); 29 ChunkRange(const ChunkRange& rhs);
28 30
29 inline int start() const { return start_; } 31 inline int start() const { return start_; }
(...skipping 21 matching lines...) Expand all
51 bool StringToRanges(const std::string& input, 53 bool StringToRanges(const std::string& input,
52 std::vector<ChunkRange>* ranges); 54 std::vector<ChunkRange>* ranges);
53 55
54 // Convenience for going from a list of chunks to a string in protocol 56 // Convenience for going from a list of chunks to a string in protocol
55 // format. 57 // format.
56 void ChunksToRangeString(const std::vector<int>& chunks, std::string* result); 58 void ChunksToRangeString(const std::vector<int>& chunks, std::string* result);
57 59
58 // Tests if a chunk number is contained a sorted vector of ChunkRanges. 60 // Tests if a chunk number is contained a sorted vector of ChunkRanges.
59 bool IsChunkInRange(int chunk_number, const std::vector<ChunkRange>& ranges); 61 bool IsChunkInRange(int chunk_number, const std::vector<ChunkRange>& ranges);
60 62
63 } // namespace safe_browsing
64
61 #endif // CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_ 65 #endif // CHROME_BROWSER_SAFE_BROWSING_CHUNK_RANGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/safe_browsing_resource_throttle.cc ('k') | chrome/browser/safe_browsing/chunk_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698