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

Side by Side Diff: printing/printed_document.cc

Issue 6516022: Linux: Refactor printing to be more like Windows/Mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac build Created 9 years, 10 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/printed_document.h" 5 #include "printing/printed_document.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return false; 102 return false;
103 } 103 }
104 104
105 bool PrintedDocument::IsComplete() const { 105 bool PrintedDocument::IsComplete() const {
106 base::AutoLock lock(lock_); 106 base::AutoLock lock(lock_);
107 if (!mutable_.page_count_) 107 if (!mutable_.page_count_)
108 return false; 108 return false;
109 PageNumber page(immutable_.settings_, mutable_.page_count_); 109 PageNumber page(immutable_.settings_, mutable_.page_count_);
110 if (page == PageNumber::npos()) 110 if (page == PageNumber::npos())
111 return false; 111 return false;
112
112 for (; page != PageNumber::npos(); ++page) { 113 for (; page != PageNumber::npos(); ++page) {
114 bool metafile_must_be_valid =
115 #if defined(OS_WIN) || defined(OS_MAC)
116 true;
117 #elif defined(OS_POSIX)
118 (page.ToInt() == 0);
119 #endif
113 PrintedPages::const_iterator itr = mutable_.pages_.find(page.ToInt()); 120 PrintedPages::const_iterator itr = mutable_.pages_.find(page.ToInt());
114 if (itr == mutable_.pages_.end() || !itr->second.get() || 121 if (itr == mutable_.pages_.end() || !itr->second.get())
115 !itr->second->native_metafile()) 122 return false;
123 if (metafile_must_be_valid && !itr->second->native_metafile())
116 return false; 124 return false;
117 } 125 }
118 return true; 126 return true;
119 } 127 }
120 128
121 void PrintedDocument::DisconnectSource() { 129 void PrintedDocument::DisconnectSource() {
122 base::AutoLock lock(lock_); 130 base::AutoLock lock(lock_);
123 mutable_.source_ = NULL; 131 mutable_.source_ = NULL;
124 } 132 }
125 133
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 name_(source->RenderSourceName()), 292 name_(source->RenderSourceName()),
285 url_(source->RenderSourceUrl()), 293 url_(source->RenderSourceUrl()),
286 cookie_(cookie) { 294 cookie_(cookie) {
287 SetDocumentDate(); 295 SetDocumentDate();
288 } 296 }
289 297
290 PrintedDocument::Immutable::~Immutable() { 298 PrintedDocument::Immutable::~Immutable() {
291 } 299 }
292 300
293 } // namespace printing 301 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698