diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 02:52:53 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 02:52:53 +0000 |
commit | 6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c (patch) | |
tree | a75584b11b8ef188b4eb3376b9146e063823a916 /chrome/browser/printing | |
parent | bf3ee201c1ca5112f7fd173fc4785aa52920c5c0 (diff) | |
download | chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.zip chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.tar.gz chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.tar.bz2 |
Move NotificationObserver, NotificationSource, and NotificationDetails to content/public/browser.
This patch got way bigger than I wanted, but once I moved NotificationDetails, I figured I might as well mvoe the others since they're in the same files. In hindsight, I should have converted a subset of files at a time by leaving a using statement in the header.
BUG=98716
TBR=joi
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r-- | chrome/browser/printing/background_printing_manager.cc | 54 | ||||
-rw-r--r-- | chrome/browser/printing/background_printing_manager.h | 14 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud.cc | 13 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud_internal.h | 14 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/printing/print_job.cc | 22 | ||||
-rw-r--r-- | chrome/browser/printing/print_job.h | 14 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_manager.cc | 8 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_manager.h | 14 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_unittest.cc | 12 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.cc | 4 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_tab_controller.cc | 41 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_tab_controller.h | 14 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_tab_controller_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/printing/print_view_manager.cc | 20 | ||||
-rw-r--r-- | chrome/browser/printing/print_view_manager.h | 14 |
16 files changed, 139 insertions, 131 deletions
diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index f1e9c24..9e8d521 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -13,8 +13,8 @@ #include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/common/notification_details.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" namespace printing { @@ -39,15 +39,16 @@ void BackgroundPrintingManager::OwnPrintPreviewTab( printing_tabs_.insert(preview_tab); registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(preview_tab)); + content::Source<TabContentsWrapper>(preview_tab)); // OwnInitiatorTabContents() may have already added this notification. TabContents* preview_contents = preview_tab->tab_contents(); - if (!registrar_.IsRegistered(this, - content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(preview_contents))) { + if (!registrar_.IsRegistered( + this, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, + content::Source<TabContents>(preview_contents))) { registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(preview_contents)); + content::Source<TabContents>(preview_contents)); } // If a tab that is printing crashes, the user cannot destroy it since it is @@ -58,9 +59,9 @@ void BackgroundPrintingManager::OwnPrintPreviewTab( RenderProcessHost* rph = preview_tab->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph))) { + content::Source<RenderProcessHost>(rph))) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph)); + content::Source<RenderProcessHost>(rph)); } RemoveFromTabStrip(preview_tab); @@ -105,33 +106,35 @@ bool BackgroundPrintingManager::OwnInitiatorTab( // OwnPrintPreviewTab() may have already added this notification. TabContents* preview_contents = preview_tab->tab_contents(); - if (!registrar_.IsRegistered(this, - content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(preview_contents))) { + if (!registrar_.IsRegistered( + this, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, + content::Source<TabContents>(preview_contents))) { registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(preview_contents)); + content::Source<TabContents>(preview_contents)); } RemoveFromTabStrip(initiator_tab); return true; } -void BackgroundPrintingManager::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void BackgroundPrintingManager::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - OnRendererProcessClosed(Source<RenderProcessHost>(source).ptr()); + OnRendererProcessClosed(content::Source<RenderProcessHost>(source).ptr()); break; } case chrome::NOTIFICATION_PRINT_JOB_RELEASED: { - OnPrintJobReleased(Source<TabContentsWrapper>(source).ptr()); + OnPrintJobReleased(content::Source<TabContentsWrapper>(source).ptr()); break; } case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { OnTabContentsDestroyed( TabContentsWrapper::GetCurrentWrapperForContents( - Source<TabContents>(source).ptr())); + content::Source<TabContents>(source).ptr())); break; } default: { @@ -154,7 +157,7 @@ void BackgroundPrintingManager::OnRendererProcessClosed( void BackgroundPrintingManager::OnPrintJobReleased( TabContentsWrapper* preview_tab) { registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(preview_tab)); + content::Source<TabContentsWrapper>(preview_tab)); // This might be happening in the middle of a RenderViewGone() loop. // Deleting |contents| later so the RenderViewGone() loop can finish. @@ -170,7 +173,7 @@ void BackgroundPrintingManager::OnTabContentsDestroyed( // Always need to remove this notification since the tab is gone. registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(preview_tab->tab_contents())); + content::Source<TabContents>(preview_tab->tab_contents())); // Delete the associated initiator tab if one exists. if (is_preview_tab_for_owned_initator_tab) { @@ -199,14 +202,15 @@ void BackgroundPrintingManager::OnTabContentsDestroyed( } if (!shared_rph) { registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph)); + content::Source<RenderProcessHost>(rph)); } // Remove other notifications and remove the tab from |printing_tabs_|. - if (registrar_.IsRegistered(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(preview_tab))) { + if (registrar_.IsRegistered( + this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, + content::Source<TabContentsWrapper>(preview_tab))) { registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(preview_tab)); + content::Source<TabContentsWrapper>(preview_tab)); } printing_tabs_.erase(preview_tab); } diff --git a/chrome/browser/printing/background_printing_manager.h b/chrome/browser/printing/background_printing_manager.h index 2ac37c7..84ae140 100644 --- a/chrome/browser/printing/background_printing_manager.h +++ b/chrome/browser/printing/background_printing_manager.h @@ -11,8 +11,8 @@ #include "base/compiler_specific.h" #include "base/threading/non_thread_safe.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class RenderProcessHost; class TabContentsWrapper; @@ -23,7 +23,7 @@ namespace printing { // The hidden tabs are no longer part of any Browser / TabStripModel. // They get deleted when the tab finishes printing. class BackgroundPrintingManager : public base::NonThreadSafe, - public NotificationObserver { + public content::NotificationObserver { public: typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; @@ -49,10 +49,10 @@ class BackgroundPrintingManager : public base::NonThreadSafe, // Returns true if |printing_tabs_| contains |preview_tab|. bool HasPrintPreviewTab(TabContentsWrapper* preview_tab); - // NotificationObserver overrides: + // content::NotificationObserver overrides: virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; private: typedef std::map<TabContentsWrapper*, TabContentsWrapper*> @@ -76,7 +76,7 @@ class BackgroundPrintingManager : public base::NonThreadSafe, // Value: initiator tab. TabContentsWrapperMap map_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); }; diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 7dac1c2..aeb368a 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -30,8 +30,8 @@ #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/notification_registrar.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/webpreferences.h" @@ -305,12 +305,13 @@ void CloudPrintFlowHandler::RegisterMessages() { CloudPrintURL(profile).GetCloudPrintServiceDialogURL()); } registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, - Source<NavigationController>(controller)); + content::Source<NavigationController>(controller)); } -void CloudPrintFlowHandler::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void CloudPrintFlowHandler::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_STOP) { // Take the opportunity to set some (minimal) additional // script permissions required for the web UI. diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h index 995b9a6..a594bd9 100644 --- a/chrome/browser/printing/print_dialog_cloud_internal.h +++ b/chrome/browser/printing/print_dialog_cloud_internal.h @@ -14,8 +14,8 @@ #include "base/synchronization/lock.h" #include "chrome/browser/ui/webui/html_dialog_ui.h" #include "content/browser/webui/web_ui.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class GURL; class CloudPrintHtmlDialogDelegateTest; @@ -101,7 +101,7 @@ class CloudPrintHtmlDialogDelegate; // Probably..), and packing up the PDF and job parameters and sending // them to the cloud. class CloudPrintFlowHandler : public WebUIMessageHandler, - public NotificationObserver { + public content::NotificationObserver { public: CloudPrintFlowHandler(const FilePath& path_to_file, const string16& print_job_title, @@ -112,10 +112,10 @@ class CloudPrintFlowHandler : public WebUIMessageHandler, // WebUIMessageHandler implementation. virtual void RegisterMessages(); - // NotificationObserver implementation. + // content::NotificationObserver implementation. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // Callbacks from the page. void HandleShowDebugger(const base::ListValue* args); @@ -136,7 +136,7 @@ class CloudPrintFlowHandler : public WebUIMessageHandler, void CancelAnyRunningTask(); CloudPrintHtmlDialogDelegate* dialog_delegate_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; FilePath path_to_file_; string16 print_job_title_; string16 print_ticket_; diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index d95a4d8..6158560 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -20,8 +20,8 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_details.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -93,8 +93,8 @@ class MockCloudPrintFlowHandler MOCK_METHOD0(RegisterMessages, void()); MOCK_METHOD3(Observe, void(int type, - const NotificationSource& source, - const NotificationDetails& details)); + const content::NotificationSource& source, + const content::NotificationDetails& details)); MOCK_METHOD1(SetDialogDelegate, void(CloudPrintHtmlDialogDelegate* delegate)); MOCK_METHOD0(CreateCloudPrintDataSender, diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index 0b180a2..9796f78 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -61,16 +61,16 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job, // Don't forget to register to our own messages. registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(this)); + content::Source<PrintJob>(this)); } void PrintJob::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK_EQ(ui_message_loop_, MessageLoop::current()); switch (type) { case chrome::NOTIFICATION_PRINT_JOB_EVENT: { - OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); + OnNotifyPrintJobEvent(*content::Details<JobEventDetails>(details).ptr()); break; } default: { @@ -126,8 +126,8 @@ void PrintJob::StartPrinting() { new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), NULL)); NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(this), - Details<JobEventDetails>(details.get())); + content::Source<PrintJob>(this), + content::Details<JobEventDetails>(details.get())); } void PrintJob::Stop() { @@ -142,7 +142,7 @@ void PrintJob::Stop() { is_job_pending_ = false; registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(this)); + content::Source<PrintJob>(this)); } // Flush the cached document. UpdatePrintedDocument(NULL); @@ -168,8 +168,8 @@ void PrintJob::Cancel() { new JobEventDetails(JobEventDetails::FAILED, NULL, NULL)); NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(this), - Details<JobEventDetails>(details.get())); + content::Source<PrintJob>(this), + content::Details<JobEventDetails>(details.get())); Stop(); is_canceling_ = false; } @@ -275,8 +275,8 @@ void PrintJob::OnDocumentDone() { new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), NULL)); NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(this), - Details<JobEventDetails>(details.get())); + content::Source<PrintJob>(this), + content::Details<JobEventDetails>(details.get())); } void PrintJob::ControlledWorkerShutdown() { diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index e0d7e46..265ed687 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h @@ -10,8 +10,8 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/browser/printing/print_job_worker_owner.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class GURL; class Thread; @@ -34,7 +34,7 @@ class PrinterQuery; // reference to the job to be sure it is kept alive. All the code in this class // runs in the UI thread. class PrintJob : public PrintJobWorkerOwner, - public NotificationObserver, + public content::NotificationObserver, public MessageLoop::DestructionObserver { public: // Create a empty PrintJob. When initializing with this constructor, @@ -46,10 +46,10 @@ class PrintJob : public PrintJobWorkerOwner, void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, int page_count); - // NotificationObserver + // content::NotificationObserver virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // PrintJobWorkerOwner virtual void GetSettingsDone(const PrintSettings& new_settings, @@ -109,7 +109,7 @@ class PrintJob : public PrintJobWorkerOwner, // eventual deadlock. void ControlledWorkerShutdown(); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; // Main message loop reference. Used to send notifications in the right // thread. diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc index c692d17..dad6ad7 100644 --- a/chrome/browser/printing/print_job_manager.cc +++ b/chrome/browser/printing/print_job_manager.cc @@ -95,12 +95,12 @@ void PrintJobManager::RegisterPrefs(PrefService* prefs) { } void PrintJobManager::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_PRINT_JOB_EVENT: { - OnPrintJobEvent(Source<PrintJob>(source).ptr(), - *Details<JobEventDetails>(details).ptr()); + OnPrintJobEvent(content::Source<PrintJob>(source).ptr(), + *content::Details<JobEventDetails>(details).ptr()); break; } default: { diff --git a/chrome/browser/printing/print_job_manager.h b/chrome/browser/printing/print_job_manager.h index 47b1052..72548da 100644 --- a/chrome/browser/printing/print_job_manager.h +++ b/chrome/browser/printing/print_job_manager.h @@ -11,8 +11,8 @@ #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "chrome/browser/prefs/pref_member.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class PrefService; @@ -24,7 +24,7 @@ class PrintJob; class PrintedPage; class PrinterQuery; -class PrintJobManager : public NotificationObserver { +class PrintJobManager : public content::NotificationObserver { public: PrintJobManager(); virtual ~PrintJobManager(); @@ -51,10 +51,10 @@ class PrintJobManager : public NotificationObserver { static void RegisterPrefs(PrefService* prefs); - // NotificationObserver + // content::NotificationObserver virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); bool printing_enabled() { return *printing_enabled_; @@ -68,7 +68,7 @@ class PrintJobManager : public NotificationObserver { void OnPrintJobEvent(PrintJob* print_job, const JobEventDetails& event_details); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; // Used to serialize access to queued_workers_. base::Lock lock_; diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc index 33171b3..54d6017 100644 --- a/chrome/browser/printing/print_job_unittest.cc +++ b/chrome/browser/printing/print_job_unittest.cc @@ -7,7 +7,7 @@ #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/public/browser/notification_registrar.h" #include "content/common/notification_service.h" #include "printing/printed_pages_source.h" #include "testing/gtest/include/gtest/gtest.h" @@ -71,12 +71,12 @@ class TestPrintJob : public printing::PrintJob { volatile bool* check_; }; -class TestPrintNotifObserv : public NotificationObserver { +class TestPrintNotifObserv : public content::NotificationObserver { public: - // NotificationObserver + // content::NotificationObserver virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { ADD_FAILURE(); } }; @@ -98,7 +98,7 @@ TEST_F(PrintJobTest, MAYBE_SimplePrint) { // This message loop is actually never run. MessageLoop current; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; TestPrintNotifObserv observ; registrar_.Add(&observ, content::NOTIFICATION_ALL, NotificationService::AllSources()); diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index e8074f79..6b4925a 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -41,8 +41,8 @@ class PrintJobWorker::NotificationTask : public Task { NotificationService::current()->Notify( 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_)); + content::Source<PrintJob>(static_cast<PrintJob*>(print_job_.get())), + content::Details<JobEventDetails>(details_)); } // The job which originates this notification. diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index 330eca5..8229b9f 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -25,8 +25,8 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_details.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "webkit/plugins/webplugininfo.h" @@ -105,16 +105,17 @@ TabContentsWrapper* PrintPreviewTabController::GetPrintPreviewForTab( return NULL; } -void PrintPreviewTabController::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void PrintPreviewTabController::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - OnRendererProcessClosed(Source<RenderProcessHost>(source).ptr()); + OnRendererProcessClosed(content::Source<RenderProcessHost>(source).ptr()); break; } case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { - TabContents* tab = Source<TabContents>(source).ptr(); + TabContents* tab = content::Source<TabContents>(source).ptr(); TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(tab); OnTabContentsDestroyed(wrapper); @@ -122,12 +123,12 @@ void PrintPreviewTabController::Observe(int type, } case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { NavigationController* controller = - Source<NavigationController>(source).ptr(); + content::Source<NavigationController>(source).ptr(); TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents( controller->tab_contents()); content::LoadCommittedDetails* load_details = - Details<content::LoadCommittedDetails>(details).ptr(); + content::Details<content::LoadCommittedDetails>(details).ptr(); OnNavEntryCommitted(wrapper, load_details); break; } @@ -338,36 +339,38 @@ void PrintPreviewTabController::SetInitiatorTabURLAndTitle( void PrintPreviewTabController::AddObservers(TabContentsWrapper* tab) { TabContents* contents = tab->tab_contents(); registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(contents)); - registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - Source<NavigationController>(&contents->controller())); + content::Source<TabContents>(contents)); + registrar_.Add( + this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::Source<NavigationController>(&contents->controller())); // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. RenderProcessHost* rph = tab->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph))) { + content::Source<RenderProcessHost>(rph))) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph)); + content::Source<RenderProcessHost>(rph)); } } void PrintPreviewTabController::RemoveObservers(TabContentsWrapper* tab) { TabContents* contents = tab->tab_contents(); registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - Source<TabContents>(contents)); - registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - Source<NavigationController>(&contents->controller())); + content::Source<TabContents>(contents)); + registrar_.Remove( + this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::Source<NavigationController>(&contents->controller())); // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. RenderProcessHost* rph = tab->render_view_host()->process(); if (registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph))) { + content::Source<RenderProcessHost>(rph))) { registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - Source<RenderProcessHost>(rph)); + content::Source<RenderProcessHost>(rph)); } } diff --git a/chrome/browser/printing/print_preview_tab_controller.h b/chrome/browser/printing/print_preview_tab_controller.h index afd8b93..ad21fbd 100644 --- a/chrome/browser/printing/print_preview_tab_controller.h +++ b/chrome/browser/printing/print_preview_tab_controller.h @@ -17,8 +17,8 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/sessions/session_id.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class Browser; class GURL; @@ -33,7 +33,7 @@ namespace printing { class PrintPreviewTabController : public base::RefCounted<PrintPreviewTabController>, - public NotificationObserver { + public content::NotificationObserver { public: PrintPreviewTabController(); @@ -58,10 +58,10 @@ class PrintPreviewTabController // Returns NULL if no initiator tab exists for |preview_tab|. TabContentsWrapper* GetInitiatorTab(TabContentsWrapper* preview_tab); - // NotificationObserver implementation. + // content::NotificationObserver implementation. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // Returns true if |tab| is a print preview tab. static bool IsPrintPreviewTab(TabContentsWrapper* tab); @@ -108,7 +108,7 @@ class PrintPreviewTabController PrintPreviewTabMap preview_tab_map_; // A registrar for listening notifications. - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; // True if the controller is waiting for a new preview tab via // content::NAVIGATION_TYPE_NEW_PAGE. diff --git a/chrome/browser/printing/print_preview_tab_controller_unittest.cc b/chrome/browser/printing/print_preview_tab_controller_unittest.cc index 8b418d4..8b45f65 100644 --- a/chrome/browser/printing/print_preview_tab_controller_unittest.cc +++ b/chrome/browser/printing/print_preview_tab_controller_unittest.cc @@ -101,8 +101,8 @@ TEST_F(PrintPreviewTabControllerUnitTest, TitleAfterReload) { details.entry = entry.get(); NotificationService::current()->Notify( content::NOTIFICATION_NAV_ENTRY_COMMITTED, - Source<NavigationController>(&preview_tab->controller()), - Details<content::LoadCommittedDetails>(&details)); + content::Source<NavigationController>(&preview_tab->controller()), + content::Details<content::LoadCommittedDetails>(&details)); EXPECT_EQ(initiator_tab->tab_contents()->GetTitle(), preview_ui->initiator_tab_title_); } diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 6ffab8e..45f0700 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -19,9 +19,9 @@ #include "chrome/common/print_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" #include "grit/generated_resources.h" #include "printing/metafile.h" #include "printing/metafile_impl.h" @@ -238,7 +238,7 @@ void PrintViewManager::OnPrintingFailed(int cookie) { NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContents>(tab_contents()), + content::Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -258,11 +258,11 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) { } void PrintViewManager::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_PRINT_JOB_EVENT: { - OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); + OnNotifyPrintJobEvent(*content::Details<JobEventDetails>(details).ptr()); break; } default: { @@ -280,7 +280,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(tab_), + content::Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; } @@ -310,7 +310,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(tab_), + content::Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; } @@ -392,7 +392,7 @@ bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) { print_job_ = new PrintJob(); print_job_->Initialize(job, this, number_pages_); registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(print_job_.get())); + content::Source<PrintJob>(print_job_.get())); printing_succeeded_ = false; return true; } @@ -452,7 +452,7 @@ void PrintViewManager::ReleasePrintJob() { PrintingDone(printing_succeeded_); registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, - Source<PrintJob>(print_job_.get())); + content::Source<PrintJob>(print_job_.get())); print_job_->DisconnectSource(); // Don't close the worker thread. print_job_ = NULL; diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index ec31134..d75e3d8 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h @@ -9,8 +9,8 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "content/browser/tab_contents/tab_contents_observer.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include "printing/printed_pages_source.h" class RenderViewHost; @@ -26,7 +26,7 @@ class PrintViewManagerObserver; // Manages the print commands in relation to a TabContents. TabContents // delegates a few printing related commands to this instance. -class PrintViewManager : public NotificationObserver, +class PrintViewManager : public content::NotificationObserver, public PrintedPagesSource, public TabContentsObserver { public: @@ -71,10 +71,10 @@ class PrintViewManager : public NotificationObserver, // PrintedPagesSource implementation. virtual string16 RenderSourceName() OVERRIDE; - // NotificationObserver implementation. + // content::NotificationObserver implementation. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; // TabContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -147,7 +147,7 @@ class PrintViewManager : public NotificationObserver, // TabContentsWrapper we're associated with. TabContentsWrapper* tab_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; // Manages the low-level talk to the printer. scoped_refptr<PrintJob> print_job_; |