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

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

Issue 506163002: Remove implicit conversions from scoped_refptr to T* in chrome/browser/printing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_view_manager_base.h" 5 #include "chrome/browser/printing/print_view_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 } // namespace 55 } // namespace
56 56
57 PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) 57 PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
58 : content::WebContentsObserver(web_contents), 58 : content::WebContentsObserver(web_contents),
59 number_pages_(0), 59 number_pages_(0),
60 printing_succeeded_(false), 60 printing_succeeded_(false),
61 inside_inner_message_loop_(false), 61 inside_inner_message_loop_(false),
62 cookie_(0), 62 cookie_(0),
63 queue_(g_browser_process->print_job_manager()->queue()) { 63 queue_(g_browser_process->print_job_manager()->queue()) {
64 DCHECK(queue_); 64 DCHECK(queue_.get());
65 #if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \ 65 #if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
66 defined(WIN_PDF_METAFILE_FOR_PRINTING) 66 defined(WIN_PDF_METAFILE_FOR_PRINTING)
67 expecting_first_page_ = true; 67 expecting_first_page_ = true;
68 #endif 68 #endif
69 Profile* profile = 69 Profile* profile =
70 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 70 Profile::FromBrowserContext(web_contents->GetBrowserContext());
71 printing_enabled_.Init( 71 printing_enabled_.Init(
72 prefs::kPrintingEnabled, 72 prefs::kPrintingEnabled,
73 profile->GetPrefs(), 73 profile->GetPrefs(),
74 base::Bind(&PrintViewManagerBase::UpdateScriptedPrintingBlocked, 74 base::Bind(&PrintViewManagerBase::UpdateScriptedPrintingBlocked,
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 if (!cookie) { 543 if (!cookie) {
544 // Out of sync. It may happens since we are completely asynchronous. Old 544 // Out of sync. It may happens since we are completely asynchronous. Old
545 // spurious message can happen if one of the processes is overloaded. 545 // spurious message can happen if one of the processes is overloaded.
546 return false; 546 return false;
547 } 547 }
548 548
549 // The job was initiated by a script. Time to get the corresponding worker 549 // The job was initiated by a script. Time to get the corresponding worker
550 // thread. 550 // thread.
551 scoped_refptr<PrinterQuery> queued_query = queue_->PopPrinterQuery(cookie); 551 scoped_refptr<PrinterQuery> queued_query = queue_->PopPrinterQuery(cookie);
552 if (!queued_query) { 552 if (!queued_query.get()) {
553 NOTREACHED(); 553 NOTREACHED();
554 return false; 554 return false;
555 } 555 }
556 556
557 if (!CreateNewPrintJob(queued_query)) { 557 if (!CreateNewPrintJob(queued_query.get())) {
558 // Don't kill anything. 558 // Don't kill anything.
559 return false; 559 return false;
560 } 560 }
561 561
562 // Settings are already loaded. Go ahead. This will set 562 // Settings are already loaded. Go ahead. This will set
563 // print_job_->is_job_pending() to true. 563 // print_job_->is_job_pending() to true.
564 print_job_->StartPrinting(); 564 print_job_->StartPrinting();
565 return true; 565 return true;
566 } 566 }
567 567
(...skipping 16 matching lines...) Expand all
584 584
585 585
586 printing::PrintJobManager* print_job_manager = 586 printing::PrintJobManager* print_job_manager =
587 g_browser_process->print_job_manager(); 587 g_browser_process->print_job_manager();
588 // May be NULL in tests. 588 // May be NULL in tests.
589 if (!print_job_manager) 589 if (!print_job_manager)
590 return; 590 return;
591 591
592 scoped_refptr<printing::PrinterQuery> printer_query; 592 scoped_refptr<printing::PrinterQuery> printer_query;
593 printer_query = queue_->PopPrinterQuery(cookie); 593 printer_query = queue_->PopPrinterQuery(cookie);
594 if (!printer_query) 594 if (!printer_query.get())
595 return; 595 return;
596 BrowserThread::PostTask( 596 BrowserThread::PostTask(
597 BrowserThread::IO, FROM_HERE, 597 BrowserThread::IO, FROM_HERE,
598 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); 598 base::Bind(&PrinterQuery::StopWorker, printer_query.get()));
599 } 599 }
600 600
601 } // namespace printing 601 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_message_handler.cc ('k') | chrome/browser/printing/printing_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698