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

Side by Side Diff: chrome/browser/printing/page_range.cc

Issue 149212: Move printing related stuff to the root printing project from the browser pro... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/printing/page_range.h"
6
7 #include "base/stl_util-inl.h"
8
9 namespace printing {
10
11 /* static */
12 std::vector<int> PageRange::GetPages(const PageRanges& ranges) {
13 std::set<int> pages;
14 for (unsigned i = 0; i < ranges.size(); ++i) {
15 const PageRange& range = ranges[i];
16 // Ranges are inclusive.
17 for (int i = range.from; i <= range.to; ++i) {
18 pages.insert(i);
19 }
20 }
21 return SetToVector(pages);
22 }
23
24 /* static */
25 int PageRange::GetTotalPages(const PageRanges& ranges) {
26 // Since ranges can overlap we need to merge them before counting
27 std::vector<int> pages = PageRange::GetPages(ranges);
28 return pages.size();
29 }
30
31 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698