| OLD | NEW |
| 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 #include "printing/page_number.h" | 5 #include "printing/page_number.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "printing/print_settings.h" | 10 #include "printing/print_settings.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void PageNumber::operator=(const PageNumber& other) { | 25 void PageNumber::operator=(const PageNumber& other) { |
| 26 ranges_ = other.ranges_; | 26 ranges_ = other.ranges_; |
| 27 page_number_ = other.page_number_; | 27 page_number_ = other.page_number_; |
| 28 page_range_index_ = other.page_range_index_; | 28 page_range_index_ = other.page_range_index_; |
| 29 document_page_count_ = other.document_page_count_; | 29 document_page_count_ = other.document_page_count_; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void PageNumber::Init(const PrintSettings& settings, int document_page_count) { | 32 void PageNumber::Init(const PrintSettings& settings, int document_page_count) { |
| 33 DCHECK(document_page_count); | 33 DCHECK(document_page_count); |
| 34 ranges_ = settings.ranges.empty() ? NULL : &settings.ranges; | 34 ranges_ = settings.ranges().empty() ? NULL : &settings.ranges(); |
| 35 document_page_count_ = document_page_count; | 35 document_page_count_ = document_page_count; |
| 36 if (ranges_) { | 36 if (ranges_) { |
| 37 page_range_index_ = 0; | 37 page_range_index_ = 0; |
| 38 page_number_ = (*ranges_)[0].from; | 38 page_number_ = (*ranges_)[0].from; |
| 39 } else { | 39 } else { |
| 40 if (document_page_count) { | 40 if (document_page_count) { |
| 41 page_number_ = 0; | 41 page_number_ = 0; |
| 42 } else { | 42 } else { |
| 43 page_number_ = -1; | 43 page_number_ = -1; |
| 44 } | 44 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 bool PageNumber::operator==(const PageNumber& other) const { | 74 bool PageNumber::operator==(const PageNumber& other) const { |
| 75 return page_number_ == other.page_number_ && | 75 return page_number_ == other.page_number_ && |
| 76 page_range_index_ == other.page_range_index_; | 76 page_range_index_ == other.page_range_index_; |
| 77 } | 77 } |
| 78 bool PageNumber::operator!=(const PageNumber& other) const { | 78 bool PageNumber::operator!=(const PageNumber& other) const { |
| 79 return page_number_ != other.page_number_ || | 79 return page_number_ != other.page_number_ || |
| 80 page_range_index_ != other.page_range_index_; | 80 page_range_index_ != other.page_range_index_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace printing | 83 } // namespace printing |
| OLD | NEW |