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(
#endif
host->AddFilter(new cast::CastTransportHostFilter);
#if defined(ENABLE_PRINTING)
host->AddFilter(new PrintingMessageFilter(id, profile));
host->AddFilter(new printing::PrintingMessageFilter(id, profile));
#endif
host->AddFilter(new SearchProviderInstallStateMessageFilter(id, profile));
#if defined(ENABLE_SPELLCHECK)
......
......@@ -25,6 +25,8 @@
using content::BrowserThread;
namespace printing {
namespace {
// Helper function to ensure |owner| is valid until at least |callback| returns.
......@@ -35,8 +37,6 @@ void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner,
} // namespace
namespace printing {
void NotificationCallback(PrintJobWorkerOwner* print_job,
JobEventDetails::Type detail_type,
PrintedDocument* document,
......
......@@ -14,18 +14,17 @@
#include "printing/printing_context.h"
#include "printing/print_job_constants.h"
class PrintingUIWebContentsObserver;
namespace base {
class DictionaryValue;
}
namespace printing {
class PrintedDocument;
class PrintedPage;
class PrintJob;
class PrintJobWorkerOwner;
class PrintedDocument;
class PrintedPage;
class PrintingUIWebContentsObserver;
// Worker thread code. It manages the PrintingContext, which can be blocking
// and/or run a message loop. This is the object that generates most
......
......@@ -11,8 +11,6 @@
#include "chrome/browser/printing/print_job_worker_owner.h"
#include "printing/print_job_constants.h"
class PrintingUIWebContentsObserver;
namespace base {
class DictionaryValue;
}
......@@ -21,6 +19,7 @@ namespace printing {
class PrintDestinationInterface;
class PrintJobWorker;
class PrintingUIWebContentsObserver;
// Query the printer for settings.
class PrinterQuery : public PrintJobWorkerOwner {
......
......@@ -28,10 +28,11 @@ class WebContents;
}
namespace printing {
class PrinterQuery;
class PrintJobManager;
class PrintQueriesQueue;
}
class PrinterQuery;
class PrintingUIWebContentsObserver;
// This class filters out incoming printing related IPC messages for the
// renderer process on the IPC thread.
......@@ -85,23 +86,20 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
// Retrieve print settings. Uses |render_view_id| to get a parent
// for any UI created if needed.
void GetPrintSettingsForRenderView(
int render_view_id,
void GetPrintSettingsForRenderView(int render_view_id,
GetPrintSettingsForRenderViewParams params,
const base::Closure& callback,
scoped_refptr<printing::PrinterQuery> printer_query);
scoped_refptr<PrinterQuery> printer_query);
void OnGetPrintSettingsFailed(
const base::Closure& callback,
scoped_refptr<printing::PrinterQuery> printer_query);
void OnGetPrintSettingsFailed(const base::Closure& callback,
scoped_refptr<PrinterQuery> printer_query);
// Checks if printing is enabled.
void OnIsPrintingEnabled(bool* is_enabled);
// Get the default print setting.
void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
void OnGetDefaultPrintSettingsReply(
scoped_refptr<printing::PrinterQuery> printer_query,
void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);
// The renderer host have to show to the user the print dialog and returns
......@@ -109,8 +107,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
// thread and the UI thread. The reply occurs on the IO thread.
void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
IPC::Message* reply_msg);
void OnScriptedPrintReply(
scoped_refptr<printing::PrinterQuery> printer_query,
void OnScriptedPrintReply(scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);
// Modify the current print settings based on |job_settings|. The task is
......@@ -119,8 +116,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
void OnUpdatePrintSettings(int document_cookie,
const base::DictionaryValue& job_settings,
IPC::Message* reply_msg);
void OnUpdatePrintSettingsReply(
scoped_refptr<printing::PrinterQuery> printer_query,
void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);
#if defined(ENABLE_FULL_PRINTING)
......@@ -134,9 +130,11 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
const int render_process_id_;
scoped_refptr<printing::PrintQueriesQueue> queue_;
scoped_refptr<PrintQueriesQueue> queue_;
DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilter);
};
} // namespace printing
#endif // CHROME_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_
......@@ -7,6 +7,8 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
namespace printing {
PrintingUIWebContentsObserver::PrintingUIWebContentsObserver(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
......@@ -21,3 +23,5 @@ gfx::NativeView PrintingUIWebContentsObserver::GetParentView() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return web_contents() ? web_contents()->GetNativeView() : NULL;
}
} // namespace printing
......@@ -9,6 +9,8 @@
#include "content/public/browser/web_contents_observer.h"
#include "ui/gfx/native_widget_types.h"
namespace printing {
// Wrapper used to keep track of the lifetime of a WebContents.
// Lives on the UI thread.
class PrintingUIWebContentsObserver : public content::WebContentsObserver {
......@@ -23,4 +25,6 @@ class PrintingUIWebContentsObserver : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(PrintingUIWebContentsObserver);
};
} // namespace printing
#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