OLD | NEW |
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_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 void PrintViewManager::Observe(int type, | 384 void PrintViewManager::Observe(int type, |
385 const content::NotificationSource& source, | 385 const content::NotificationSource& source, |
386 const content::NotificationDetails& details) { | 386 const content::NotificationDetails& details) { |
387 switch (type) { | 387 switch (type) { |
388 case chrome::NOTIFICATION_PRINT_JOB_EVENT: { | 388 case chrome::NOTIFICATION_PRINT_JOB_EVENT: { |
389 OnNotifyPrintJobEvent(*content::Details<JobEventDetails>(details).ptr()); | 389 OnNotifyPrintJobEvent(*content::Details<JobEventDetails>(details).ptr()); |
390 break; | 390 break; |
391 } | 391 } |
392 case chrome::NOTIFICATION_PREF_CHANGED: { | |
393 UpdateScriptedPrintingBlocked(); | |
394 break; | |
395 } | |
396 case chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED: { | 392 case chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED: { |
397 tab_content_blocked_ = *content::Details<const bool>(details).ptr(); | 393 tab_content_blocked_ = *content::Details<const bool>(details).ptr(); |
398 UpdateScriptedPrintingBlocked(); | 394 UpdateScriptedPrintingBlocked(); |
399 break; | 395 break; |
400 } | 396 } |
401 default: { | 397 default: { |
402 NOTREACHED(); | 398 NOTREACHED(); |
403 break; | 399 break; |
404 } | 400 } |
405 } | 401 } |
406 } | 402 } |
407 | 403 |
| 404 void PrintViewManager::OnPreferenceChanged(PrefServiceBase* service, |
| 405 const std::string& pref_name) { |
| 406 UpdateScriptedPrintingBlocked(); |
| 407 } |
| 408 |
408 void PrintViewManager::OnNotifyPrintJobEvent( | 409 void PrintViewManager::OnNotifyPrintJobEvent( |
409 const JobEventDetails& event_details) { | 410 const JobEventDetails& event_details) { |
410 switch (event_details.type()) { | 411 switch (event_details.type()) { |
411 case JobEventDetails::FAILED: { | 412 case JobEventDetails::FAILED: { |
412 TerminatePrintJob(true); | 413 TerminatePrintJob(true); |
413 | 414 |
414 content::NotificationService::current()->Notify( | 415 content::NotificationService::current()->Notify( |
415 chrome::NOTIFICATION_PRINT_JOB_RELEASED, | 416 chrome::NOTIFICATION_PRINT_JOB_RELEASED, |
416 content::Source<content::WebContents>(web_contents()), | 417 content::Source<content::WebContents>(web_contents()), |
417 content::NotificationService::NoDetails()); | 418 content::NotificationService::NoDetails()); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 scoped_refptr<printing::PrinterQuery> printer_query; | 684 scoped_refptr<printing::PrinterQuery> printer_query; |
684 print_job_manager->PopPrinterQuery(cookie, &printer_query); | 685 print_job_manager->PopPrinterQuery(cookie, &printer_query); |
685 if (!printer_query.get()) | 686 if (!printer_query.get()) |
686 return; | 687 return; |
687 BrowserThread::PostTask( | 688 BrowserThread::PostTask( |
688 BrowserThread::IO, FROM_HERE, | 689 BrowserThread::IO, FROM_HERE, |
689 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 690 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
690 } | 691 } |
691 | 692 |
692 } // namespace printing | 693 } // namespace printing |
OLD | NEW |