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

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

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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_manager.h" 5 #include "chrome/browser/printing/print_job_manager.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/printing/print_job.h" 8 #include "chrome/browser/printing/print_job.h"
9 #include "chrome/browser/printing/printer_query.h" 9 #include "chrome/browser/printing/printer_query.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (wait_for_finish) 105 if (wait_for_finish)
106 (*job)->FlushJob(base::TimeDelta::FromMinutes(2)); 106 (*job)->FlushJob(base::TimeDelta::FromMinutes(2));
107 (*job)->Stop(); 107 (*job)->Stop();
108 } 108 }
109 } 109 }
110 110
111 void PrintJobManager::Observe(int type, 111 void PrintJobManager::Observe(int type,
112 const content::NotificationSource& source, 112 const content::NotificationSource& source,
113 const content::NotificationDetails& details) { 113 const content::NotificationDetails& details) {
114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
115 switch (type) { 115 DCHECK_EQ(chrome::NOTIFICATION_PRINT_JOB_EVENT, type);
116 case chrome::NOTIFICATION_PRINT_JOB_EVENT: { 116
117 OnPrintJobEvent(content::Source<PrintJob>(source).ptr(), 117 OnPrintJobEvent(content::Source<PrintJob>(source).ptr(),
118 *content::Details<JobEventDetails>(details).ptr()); 118 *content::Details<JobEventDetails>(details).ptr());
119 break;
120 }
121 default: {
122 NOTREACHED();
123 break;
124 }
125 }
126 } 119 }
127 120
128 void PrintJobManager::OnPrintJobEvent( 121 void PrintJobManager::OnPrintJobEvent(
129 PrintJob* print_job, 122 PrintJob* print_job,
130 const JobEventDetails& event_details) { 123 const JobEventDetails& event_details) {
131 switch (event_details.type()) { 124 switch (event_details.type()) {
132 case JobEventDetails::NEW_DOC: { 125 case JobEventDetails::NEW_DOC: {
133 DCHECK(current_jobs_.end() == current_jobs_.find(print_job)); 126 DCHECK(current_jobs_.end() == current_jobs_.find(print_job));
134 // Causes a AddRef(). 127 // Causes a AddRef().
135 current_jobs_.insert(print_job); 128 current_jobs_.insert(print_job);
(...skipping 19 matching lines...) Expand all
155 break; 148 break;
156 } 149 }
157 default: { 150 default: {
158 NOTREACHED(); 151 NOTREACHED();
159 break; 152 break;
160 } 153 }
161 } 154 }
162 } 155 }
163 156
164 } // namespace printing 157 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698