| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/browser/printing/print_job_manager.h" | 5 #include "chrome/browser/printing/print_job_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/printing/print_job.h" | 9 #include "chrome/browser/printing/print_job.h" |
| 10 #include "chrome/browser/printing/printer_query.h" | 10 #include "chrome/browser/printing/printer_query.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 12 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
| 13 #include "printing/printed_document.h" | 14 #include "printing/printed_document.h" |
| 14 #include "printing/printed_page.h" | 15 #include "printing/printed_page.h" |
| 15 | 16 |
| 16 namespace printing { | 17 namespace printing { |
| 17 | 18 |
| 18 PrintJobManager::PrintJobManager() { | 19 PrintJobManager::PrintJobManager() { |
| 19 registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, | 20 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, |
| 20 NotificationService::AllSources()); | 21 NotificationService::AllSources()); |
| 21 } | 22 } |
| 22 | 23 |
| 23 PrintJobManager::~PrintJobManager() { | 24 PrintJobManager::~PrintJobManager() { |
| 24 base::AutoLock lock(lock_); | 25 base::AutoLock lock(lock_); |
| 25 queued_queries_.clear(); | 26 queued_queries_.clear(); |
| 26 } | 27 } |
| 27 | 28 |
| 28 void PrintJobManager::InitOnUIThread(PrefService* prefs) { | 29 void PrintJobManager::InitOnUIThread(PrefService* prefs) { |
| 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return; | 87 return; |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| 91 // static | 92 // static |
| 92 void PrintJobManager::RegisterPrefs(PrefService* prefs) { | 93 void PrintJobManager::RegisterPrefs(PrefService* prefs) { |
| 93 prefs->RegisterBooleanPref(prefs::kPrintingEnabled, true); | 94 prefs->RegisterBooleanPref(prefs::kPrintingEnabled, true); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void PrintJobManager::Observe(NotificationType type, | 97 void PrintJobManager::Observe(int type, |
| 97 const NotificationSource& source, | 98 const NotificationSource& source, |
| 98 const NotificationDetails& details) { | 99 const NotificationDetails& details) { |
| 99 switch (type.value) { | 100 switch (type) { |
| 100 case NotificationType::PRINT_JOB_EVENT: { | 101 case chrome::NOTIFICATION_PRINT_JOB_EVENT: { |
| 101 OnPrintJobEvent(Source<PrintJob>(source).ptr(), | 102 OnPrintJobEvent(Source<PrintJob>(source).ptr(), |
| 102 *Details<JobEventDetails>(details).ptr()); | 103 *Details<JobEventDetails>(details).ptr()); |
| 103 break; | 104 break; |
| 104 } | 105 } |
| 105 default: { | 106 default: { |
| 106 NOTREACHED(); | 107 NOTREACHED(); |
| 107 break; | 108 break; |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 } | 111 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 break; | 158 break; |
| 158 } | 159 } |
| 159 default: { | 160 default: { |
| 160 NOTREACHED(); | 161 NOTREACHED(); |
| 161 break; | 162 break; |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace printing | 167 } // namespace printing |
| OLD | NEW |