diff options
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r-- | chrome/browser/printing/background_printing_manager.cc | 21 | ||||
-rw-r--r-- | chrome/browser/printing/background_printing_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud.cc | 8 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud_internal.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/printing/print_job.cc | 17 | ||||
-rw-r--r-- | chrome/browser/printing/print_job.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.cc | 3 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_tab_controller.cc | 16 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_tab_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_view_manager.cc | 17 | ||||
-rw-r--r-- | chrome/browser/printing/print_view_manager.h | 2 |
15 files changed, 59 insertions, 53 deletions
diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 3a4b32e..1c4c8ff 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -10,6 +10,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -36,9 +37,9 @@ void BackgroundPrintingManager::OwnTabContents(TabContentsWrapper* contents) { printing_contents_.insert(contents); - registrar_.Add(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(contents)); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(contents->tab_contents())); // Detach |contents| from its tab strip. @@ -61,13 +62,13 @@ void BackgroundPrintingManager::OwnTabContents(TabContentsWrapper* contents) { initiator_tab->Activate(); } -void BackgroundPrintingManager::Observe(NotificationType type, +void BackgroundPrintingManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_RELEASED: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_RELEASED: { TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); - registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab)); // This might be happening in the middle of a RenderViewGone() loop. @@ -75,16 +76,16 @@ void BackgroundPrintingManager::Observe(NotificationType type, MessageLoop::current()->DeleteSoon(FROM_HERE, tab); break; } - case NotificationType::TAB_CONTENTS_DESTROYED: { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<TabContents>(source).ptr()); - if (registrar_.IsRegistered(this, NotificationType::PRINT_JOB_RELEASED, + if (registrar_.IsRegistered(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab))) { - registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab)); } - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab->tab_contents())); printing_contents_.erase(tab); break; diff --git a/chrome/browser/printing/background_printing_manager.h b/chrome/browser/printing/background_printing_manager.h index fb77f0a..4d935fa 100644 --- a/chrome/browser/printing/background_printing_manager.h +++ b/chrome/browser/printing/background_printing_manager.h @@ -40,7 +40,7 @@ class BackgroundPrintingManager bool HasTabContents(TabContentsWrapper* entry); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 7e653e0..edd9881 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -27,9 +27,9 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/webui/web_ui.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/view_messages.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/webpreferences.h" @@ -270,15 +270,15 @@ void CloudPrintFlowHandler::RegisterMessages() { if (pending_entry) pending_entry->set_url(CloudPrintURL( web_ui_->GetProfile()).GetCloudPrintServiceDialogURL()); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); } } -void CloudPrintFlowHandler::Observe(NotificationType type, +void CloudPrintFlowHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::LOAD_STOP) { + if (type == content::NOTIFICATION_LOAD_STOP) { // Take the opportunity to set some (minimal) additional // script permissions required for the web UI. GURL url = web_ui_->tab_contents()->GetURL(); diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h index 1ceb2fb..23f8e2b 100644 --- a/chrome/browser/printing/print_dialog_cloud_internal.h +++ b/chrome/browser/printing/print_dialog_cloud_internal.h @@ -101,7 +101,7 @@ class CloudPrintFlowHandler : public WebUIMessageHandler, virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 688f5e4..86a832c 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -20,9 +20,9 @@ #include "chrome/common/url_constants.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -88,7 +88,7 @@ class MockCloudPrintFlowHandler MOCK_METHOD0(DestructorCalled, void()); MOCK_METHOD0(RegisterMessages, void()); MOCK_METHOD3(Observe, - void(NotificationType type, + void(int type, const NotificationSource& source, const NotificationDetails& details)); MOCK_METHOD1(SetDialogDelegate, diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index 898f8ae..c1e61e3 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -8,6 +8,7 @@ #include "base/threading/thread_restrictions.h" #include "base/timer.h" #include "chrome/browser/printing/print_job_worker.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "printing/printed_document.h" #include "printing/printed_page.h" @@ -59,16 +60,16 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job, UpdatePrintedDocument(new_doc); // Don't forget to register to our own messages. - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this)); } -void PrintJob::Observe(NotificationType type, +void PrintJob::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK_EQ(ui_message_loop_, MessageLoop::current()); - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); break; } @@ -124,7 +125,7 @@ void PrintJob::StartPrinting() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); } @@ -140,7 +141,7 @@ void PrintJob::Stop() { ControlledWorkerShutdown(); is_job_pending_ = false; - registrar_.Remove(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this)); } // Flush the cached document. @@ -166,7 +167,7 @@ void PrintJob::Cancel() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::FAILED, NULL, NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); Stop(); @@ -273,7 +274,7 @@ void PrintJob::OnDocumentDone() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); } diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index 023d5d5..e0d7e46 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h @@ -47,7 +47,7 @@ class PrintJob : public PrintJobWorkerOwner, int page_count); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc index 59b9d04..c692d17 100644 --- a/chrome/browser/printing/print_job_manager.cc +++ b/chrome/browser/printing/print_job_manager.cc @@ -8,6 +8,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/printer_query.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" #include "printing/printed_document.h" @@ -16,7 +17,7 @@ namespace printing { PrintJobManager::PrintJobManager() { - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, NotificationService::AllSources()); } @@ -93,11 +94,11 @@ void PrintJobManager::RegisterPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kPrintingEnabled, true); } -void PrintJobManager::Observe(NotificationType type, +void PrintJobManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnPrintJobEvent(Source<PrintJob>(source).ptr(), *Details<JobEventDetails>(details).ptr()); break; diff --git a/chrome/browser/printing/print_job_manager.h b/chrome/browser/printing/print_job_manager.h index c6089df..47b1052 100644 --- a/chrome/browser/printing/print_job_manager.h +++ b/chrome/browser/printing/print_job_manager.h @@ -52,7 +52,7 @@ class PrintJobManager : public NotificationObserver { static void RegisterPrefs(PrefService* prefs); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc index 22ebced..4ca676c 100644 --- a/chrome/browser/printing/print_job_unittest.cc +++ b/chrome/browser/printing/print_job_unittest.cc @@ -6,6 +6,7 @@ #include "base/string16.h" #include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/print_job_worker.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -76,7 +77,7 @@ class TestPrintJob : public printing::PrintJob { class TestPrintNotifObserv : public NotificationObserver { public: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { EXPECT_FALSE(true); @@ -94,7 +95,7 @@ TEST(PrintJobTest, SimplePrint) { NotificationRegistrar registrar_; TestPrintNotifObserv observ; - registrar_.Add(&observ, NotificationType::ALL, + registrar_.Add(&observ, content::NOTIFICATION_ALL, NotificationService::AllSources()); volatile bool check = false; scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 1d0fc4f..7a850c0 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -8,6 +8,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_job.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "printing/print_job_constants.h" @@ -38,7 +39,7 @@ class PrintJobWorker::NotificationTask : public Task { virtual void Run() { // Send the notification in the right thread. NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, // We know that is is a PrintJob object in this circumstance. Source<PrintJob>(static_cast<PrintJob*>(print_job_.get())), Details<JobEventDetails>(details_)); diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index aef4dd1..b568d19 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -77,18 +77,18 @@ TabContents* PrintPreviewTabController::GetPrintPreviewForTab( return NULL; } -void PrintPreviewTabController::Observe(NotificationType type, +void PrintPreviewTabController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContents* source_tab = NULL; content::LoadCommittedDetails* detail_info = NULL; - switch (type.value) { - case NotificationType::TAB_CONTENTS_DESTROYED: { + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { source_tab = Source<TabContents>(source).ptr(); break; } - case NotificationType::NAV_ENTRY_COMMITTED: { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { NavigationController* controller = Source<NavigationController>(source).ptr(); source_tab = controller->tab_contents(); @@ -234,16 +234,16 @@ TabContents* PrintPreviewTabController::CreatePrintPreviewTab( } void PrintPreviewTabController::AddObservers(TabContents* tab) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab->controller())); } void PrintPreviewTabController::RemoveObservers(TabContents* tab) { - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab->controller())); } diff --git a/chrome/browser/printing/print_preview_tab_controller.h b/chrome/browser/printing/print_preview_tab_controller.h index 7c03016..6bfc8dc 100644 --- a/chrome/browser/printing/print_preview_tab_controller.h +++ b/chrome/browser/printing/print_preview_tab_controller.h @@ -53,7 +53,7 @@ class PrintPreviewTabController TabContents* GetInitiatorTab(TabContents* preview_tab); // Notification observer implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 39c485c..adc94b9 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -14,6 +14,7 @@ #include "chrome/browser/printing/print_view_manager_observer.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/print_preview_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/print_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -223,7 +224,7 @@ void PrintViewManager::OnPrintingFailed(int cookie) { ReleasePrinterQuery(cookie); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -243,11 +244,11 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) { return handled; } -void PrintViewManager::Observe(NotificationType type, +void PrintViewManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); break; } @@ -265,7 +266,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( TerminatePrintJob(true); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; @@ -295,7 +296,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( ReleasePrintJob(); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; @@ -377,7 +378,7 @@ bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) { print_job_ = new PrintJob(); print_job_->Initialize(job, this, number_pages_); - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(print_job_.get())); printing_succeeded_ = false; return true; @@ -437,7 +438,7 @@ void PrintViewManager::ReleasePrintJob() { PrintingDone(printing_succeeded_); - registrar_.Remove(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(print_job_.get())); print_job_->DisconnectSource(); // Don't close the worker thread. diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index 6a1314f..698038b 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h @@ -61,7 +61,7 @@ class PrintViewManager : public NotificationObserver, virtual GURL RenderSourceUrl(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); |