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

Unified Diff: chrome/browser/printing/page_range.cc

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/page_range.h ('k') | chrome/browser/printing/page_range_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/page_range.cc
===================================================================
--- chrome/browser/printing/page_range.cc (revision 18804)
+++ chrome/browser/printing/page_range.cc (working copy)
@@ -8,6 +8,7 @@
namespace printing {
+/* static */
std::vector<int> PageRange::GetPages(const PageRanges& ranges) {
std::set<int> pages;
for (unsigned i = 0; i < ranges.size(); ++i) {
@@ -20,4 +21,11 @@
return SetToVector(pages);
}
+/* static */
+int PageRange::GetTotalPages(const PageRanges& ranges) {
+ // Since ranges can overlap we need to merge them before counting
+ std::vector<int> pages = PageRange::GetPages(ranges);
+ return pages.size();
+}
+
} // namespace printing
« no previous file with comments | « chrome/browser/printing/page_range.h ('k') | chrome/browser/printing/page_range_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698