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

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

Issue 16296002: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/printing/print_job_worker.h" 5 #include "chrome/browser/printing/print_job_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 void PrintJobWorker::StartPrinting(PrintedDocument* new_document) { 196 void PrintJobWorker::StartPrinting(PrintedDocument* new_document) {
197 DCHECK_EQ(message_loop(), base::MessageLoop::current()); 197 DCHECK_EQ(message_loop(), base::MessageLoop::current());
198 DCHECK_EQ(page_number_, PageNumber::npos()); 198 DCHECK_EQ(page_number_, PageNumber::npos());
199 DCHECK_EQ(document_, new_document); 199 DCHECK_EQ(document_, new_document);
200 DCHECK(document_.get()); 200 DCHECK(document_.get());
201 DCHECK(new_document->settings().Equals(printing_context_->settings())); 201 DCHECK(new_document->settings().Equals(printing_context_->settings()));
202 202
203 if (!document_.get() || page_number_ != PageNumber::npos() || 203 if (!document_.get() || page_number_ != PageNumber::npos() ||
204 document_ != new_document) { 204 document_.get() != new_document) {
205 return; 205 return;
206 } 206 }
207 207
208 string16 document_name = 208 string16 document_name =
209 printing::PrintBackend::SimplifyDocumentTitle(document_->name()); 209 printing::PrintBackend::SimplifyDocumentTitle(document_->name());
210 if (document_name.empty()) { 210 if (document_name.empty()) {
211 document_name = printing::PrintBackend::SimplifyDocumentTitle( 211 document_name = printing::PrintBackend::SimplifyDocumentTitle(
212 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); 212 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE));
213 } 213 }
214 PrintingContext::Result result = 214 PrintingContext::Result result =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 scoped_refptr<PrintedPage> page; 267 scoped_refptr<PrintedPage> page;
268 if (!document_->GetPage(page_number_.ToInt(), &page)) { 268 if (!document_->GetPage(page_number_.ToInt(), &page)) {
269 // We need to wait for the page to be available. 269 // We need to wait for the page to be available.
270 base::MessageLoop::current()->PostDelayedTask( 270 base::MessageLoop::current()->PostDelayedTask(
271 FROM_HERE, 271 FROM_HERE,
272 base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()), 272 base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()),
273 base::TimeDelta::FromMilliseconds(500)); 273 base::TimeDelta::FromMilliseconds(500));
274 break; 274 break;
275 } 275 }
276 // The page is there, print it. 276 // The page is there, print it.
277 SpoolPage(page); 277 SpoolPage(page.get());
278 ++page_number_; 278 ++page_number_;
279 if (page_number_ == PageNumber::npos()) { 279 if (page_number_ == PageNumber::npos()) {
280 OnDocumentDone(); 280 OnDocumentDone();
281 // Don't touch this anymore since the instance could be destroyed. 281 // Don't touch this anymore since the instance could be destroyed.
282 break; 282 break;
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 void PrintJobWorker::Cancel() { 287 void PrintJobWorker::Cancel() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 JobEventDetails::FAILED, document_, 370 JobEventDetails::FAILED, document_,
371 scoped_refptr<PrintedPage>())); 371 scoped_refptr<PrintedPage>()));
372 Cancel(); 372 Cancel();
373 373
374 // Makes sure the variables are reinitialized. 374 // Makes sure the variables are reinitialized.
375 document_ = NULL; 375 document_ = NULL;
376 page_number_ = PageNumber::npos(); 376 page_number_ = PageNumber::npos();
377 } 377 }
378 378
379 } // namespace printing 379 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_manager.cc ('k') | chrome/browser/printing/print_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698