Put PrintingUIWebContentsObserver and PrintingMessageFilter into printing namespace.


BUG=374321
TBR=noamsml

Review URL: https://codereview.chromium.org/492623004

Cr-Commit-Position: refs/heads/master@{#290815}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290815 0039d316-1c4b-4281-b951-d872f2087c98
parent 62f932ad
...@@ -802,7 +802,7 @@ void ChromeContentBrowserClient::RenderProcessWillLaunch( ...@@ -802,7 +802,7 @@ void ChromeContentBrowserClient::RenderProcessWillLaunch(
#endif #endif
host->AddFilter(new cast::CastTransportHostFilter); host->AddFilter(new cast::CastTransportHostFilter);
#if defined(ENABLE_PRINTING) #if defined(ENABLE_PRINTING)
host->AddFilter(new PrintingMessageFilter(id, profile)); host->AddFilter(new printing::PrintingMessageFilter(id, profile));
#endif #endif
host->AddFilter(new SearchProviderInstallStateMessageFilter(id, profile)); host->AddFilter(new SearchProviderInstallStateMessageFilter(id, profile));
#if defined(ENABLE_SPELLCHECK) #if defined(ENABLE_SPELLCHECK)
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
using content::BrowserThread; using content::BrowserThread;
namespace printing {
namespace { namespace {
// Helper function to ensure |owner| is valid until at least |callback| returns. // Helper function to ensure |owner| is valid until at least |callback| returns.
...@@ -35,8 +37,6 @@ void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner, ...@@ -35,8 +37,6 @@ void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner,
} // namespace } // namespace
namespace printing {
void NotificationCallback(PrintJobWorkerOwner* print_job, void NotificationCallback(PrintJobWorkerOwner* print_job,
JobEventDetails::Type detail_type, JobEventDetails::Type detail_type,
PrintedDocument* document, PrintedDocument* document,
......
...@@ -14,18 +14,17 @@ ...@@ -14,18 +14,17 @@
#include "printing/printing_context.h" #include "printing/printing_context.h"
#include "printing/print_job_constants.h" #include "printing/print_job_constants.h"
class PrintingUIWebContentsObserver;
namespace base { namespace base {
class DictionaryValue; class DictionaryValue;
} }
namespace printing { namespace printing {
class PrintedDocument;
class PrintedPage;
class PrintJob; class PrintJob;
class PrintJobWorkerOwner; class PrintJobWorkerOwner;
class PrintedDocument;
class PrintedPage;
class PrintingUIWebContentsObserver;
// Worker thread code. It manages the PrintingContext, which can be blocking // Worker thread code. It manages the PrintingContext, which can be blocking
// and/or run a message loop. This is the object that generates most // and/or run a message loop. This is the object that generates most
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#include "chrome/browser/printing/print_job_worker_owner.h" #include "chrome/browser/printing/print_job_worker_owner.h"
#include "printing/print_job_constants.h" #include "printing/print_job_constants.h"
class PrintingUIWebContentsObserver;
namespace base { namespace base {
class DictionaryValue; class DictionaryValue;
} }
...@@ -21,6 +19,7 @@ namespace printing { ...@@ -21,6 +19,7 @@ namespace printing {
class PrintDestinationInterface; class PrintDestinationInterface;
class PrintJobWorker; class PrintJobWorker;
class PrintingUIWebContentsObserver;
// Query the printer for settings. // Query the printer for settings.
class PrinterQuery : public PrintJobWorkerOwner { class PrinterQuery : public PrintJobWorkerOwner {
......
...@@ -28,10 +28,11 @@ class WebContents; ...@@ -28,10 +28,11 @@ class WebContents;
} }
namespace printing { namespace printing {
class PrinterQuery;
class PrintJobManager; class PrintJobManager;
class PrintQueriesQueue; class PrintQueriesQueue;
} class PrinterQuery;
class PrintingUIWebContentsObserver;
// This class filters out incoming printing related IPC messages for the // This class filters out incoming printing related IPC messages for the
// renderer process on the IPC thread. // renderer process on the IPC thread.
...@@ -85,33 +86,29 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -85,33 +86,29 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
// Retrieve print settings. Uses |render_view_id| to get a parent // Retrieve print settings. Uses |render_view_id| to get a parent
// for any UI created if needed. // for any UI created if needed.
void GetPrintSettingsForRenderView( void GetPrintSettingsForRenderView(int render_view_id,
int render_view_id, GetPrintSettingsForRenderViewParams params,
GetPrintSettingsForRenderViewParams params, const base::Closure& callback,
const base::Closure& callback, scoped_refptr<PrinterQuery> printer_query);
scoped_refptr<printing::PrinterQuery> printer_query);
void OnGetPrintSettingsFailed( void OnGetPrintSettingsFailed(const base::Closure& callback,
const base::Closure& callback, scoped_refptr<PrinterQuery> printer_query);
scoped_refptr<printing::PrinterQuery> printer_query);
// Checks if printing is enabled. // Checks if printing is enabled.
void OnIsPrintingEnabled(bool* is_enabled); void OnIsPrintingEnabled(bool* is_enabled);
// Get the default print setting. // Get the default print setting.
void OnGetDefaultPrintSettings(IPC::Message* reply_msg); void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
void OnGetDefaultPrintSettingsReply( void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
scoped_refptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg);
IPC::Message* reply_msg);
// The renderer host have to show to the user the print dialog and returns // The renderer host have to show to the user the print dialog and returns
// the selected print settings. The task is handled by the print worker // the selected print settings. The task is handled by the print worker
// thread and the UI thread. The reply occurs on the IO thread. // thread and the UI thread. The reply occurs on the IO thread.
void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
IPC::Message* reply_msg); IPC::Message* reply_msg);
void OnScriptedPrintReply( void OnScriptedPrintReply(scoped_refptr<PrinterQuery> printer_query,
scoped_refptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg);
IPC::Message* reply_msg);
// Modify the current print settings based on |job_settings|. The task is // Modify the current print settings based on |job_settings|. The task is
// handled by the print worker thread and the UI thread. The reply occurs on // handled by the print worker thread and the UI thread. The reply occurs on
...@@ -119,9 +116,8 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -119,9 +116,8 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
void OnUpdatePrintSettings(int document_cookie, void OnUpdatePrintSettings(int document_cookie,
const base::DictionaryValue& job_settings, const base::DictionaryValue& job_settings,
IPC::Message* reply_msg); IPC::Message* reply_msg);
void OnUpdatePrintSettingsReply( void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
scoped_refptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg);
IPC::Message* reply_msg);
#if defined(ENABLE_FULL_PRINTING) #if defined(ENABLE_FULL_PRINTING)
// Check to see if print preview has been cancelled. // Check to see if print preview has been cancelled.
...@@ -134,9 +130,11 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -134,9 +130,11 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
const int render_process_id_; const int render_process_id_;
scoped_refptr<printing::PrintQueriesQueue> queue_; scoped_refptr<PrintQueriesQueue> queue_;
DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilter); DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilter);
}; };
} // namespace printing
#endif // CHROME_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_ #endif // CHROME_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
namespace printing {
PrintingUIWebContentsObserver::PrintingUIWebContentsObserver( PrintingUIWebContentsObserver::PrintingUIWebContentsObserver(
content::WebContents* web_contents) content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) { : content::WebContentsObserver(web_contents) {
...@@ -21,3 +23,5 @@ gfx::NativeView PrintingUIWebContentsObserver::GetParentView() { ...@@ -21,3 +23,5 @@ gfx::NativeView PrintingUIWebContentsObserver::GetParentView() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return web_contents() ? web_contents()->GetNativeView() : NULL; return web_contents() ? web_contents()->GetNativeView() : NULL;
} }
} // namespace printing
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
namespace printing {
// Wrapper used to keep track of the lifetime of a WebContents. // Wrapper used to keep track of the lifetime of a WebContents.
// Lives on the UI thread. // Lives on the UI thread.
class PrintingUIWebContentsObserver : public content::WebContentsObserver { class PrintingUIWebContentsObserver : public content::WebContentsObserver {
...@@ -23,4 +25,6 @@ class PrintingUIWebContentsObserver : public content::WebContentsObserver { ...@@ -23,4 +25,6 @@ class PrintingUIWebContentsObserver : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(PrintingUIWebContentsObserver); DISALLOW_COPY_AND_ASSIGN(PrintingUIWebContentsObserver);
}; };
} // namespace printing
#endif // CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_ #endif // CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment