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 {
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/printing/printing_ui_web_contents_observer.h" #include "chrome/browser/printing/printing_ui_web_contents_observer.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_io_data.h"
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
using content::BrowserThread; using content::BrowserThread;
namespace printing {
namespace { namespace {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -55,7 +57,7 @@ static base::LazyInstance<PrintingSequencePathMap> ...@@ -55,7 +57,7 @@ static base::LazyInstance<PrintingSequencePathMap>
g_printing_file_descriptor_map = LAZY_INSTANCE_INITIALIZER; g_printing_file_descriptor_map = LAZY_INSTANCE_INITIALIZER;
#endif #endif
void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, void RenderParamsFromPrintSettings(const PrintSettings& settings,
PrintMsg_Print_Params* params) { PrintMsg_Print_Params* params) {
params->page_size = settings.page_setup_device_units().physical_size(); params->page_size = settings.page_setup_device_units().physical_size();
params->content_size.SetSize( params->content_size.SetSize(
...@@ -186,8 +188,8 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting( ...@@ -186,8 +188,8 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting(
content::WebContents* wc = GetWebContentsForRenderView(render_view_id); content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
if (!wc) if (!wc)
return; return;
printing::PrintViewManagerBasic* print_view_manager = PrintViewManagerBasic* print_view_manager =
printing::PrintViewManagerBasic::FromWebContents(wc); PrintViewManagerBasic::FromWebContents(wc);
// The file descriptor is originally created in & passed from the Android // The file descriptor is originally created in & passed from the Android
// side, and it will handle the closing. // side, and it will handle the closing.
const base::FileDescriptor& file_descriptor = const base::FileDescriptor& file_descriptor =
...@@ -220,11 +222,11 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_view_id, ...@@ -220,11 +222,11 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_view_id,
content::WebContents* wc = GetWebContentsForRenderView(render_view_id); content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
if (!wc) if (!wc)
return; return;
printing::PrintViewManagerBasic* print_view_manager = PrintViewManagerBasic* print_view_manager =
printing::PrintViewManagerBasic::FromWebContents(wc); PrintViewManagerBasic::FromWebContents(wc);
const base::FileDescriptor& file_descriptor = const base::FileDescriptor& file_descriptor =
print_view_manager->file_descriptor(); print_view_manager->file_descriptor();
printing::PrintingContextAndroid::PdfWritingDone(file_descriptor.fd, true); PrintingContextAndroid::PdfWritingDone(file_descriptor.fd, true);
// Invalidate the file descriptor so it doesn't accidentally get reused. // Invalidate the file descriptor so it doesn't accidentally get reused.
print_view_manager->set_file_descriptor(base::FileDescriptor(-1, false)); print_view_manager->set_file_descriptor(base::FileDescriptor(-1, false));
#endif #endif
...@@ -257,28 +259,32 @@ content::WebContents* PrintingMessageFilter::GetWebContentsForRenderView( ...@@ -257,28 +259,32 @@ content::WebContents* PrintingMessageFilter::GetWebContentsForRenderView(
} }
struct PrintingMessageFilter::GetPrintSettingsForRenderViewParams { struct PrintingMessageFilter::GetPrintSettingsForRenderViewParams {
printing::PrinterQuery::GetSettingsAskParam ask_user_for_settings; PrinterQuery::GetSettingsAskParam ask_user_for_settings;
int expected_page_count; int expected_page_count;
bool has_selection; bool has_selection;
printing::MarginType margin_type; MarginType margin_type;
}; };
void PrintingMessageFilter::GetPrintSettingsForRenderView( void PrintingMessageFilter::GetPrintSettingsForRenderView(
int render_view_id, int render_view_id,
GetPrintSettingsForRenderViewParams params, GetPrintSettingsForRenderViewParams params,
const base::Closure& callback, const base::Closure& callback,
scoped_refptr<printing::PrinterQuery> printer_query) { scoped_refptr<PrinterQuery> printer_query) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::WebContents* wc = GetWebContentsForRenderView(render_view_id); content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
if (wc) { if (wc) {
scoped_ptr<PrintingUIWebContentsObserver> wc_observer( scoped_ptr<PrintingUIWebContentsObserver> wc_observer(
new PrintingUIWebContentsObserver(wc)); new PrintingUIWebContentsObserver(wc));
BrowserThread::PostTask( BrowserThread::PostTask(BrowserThread::IO,
BrowserThread::IO, FROM_HERE, FROM_HERE,
base::Bind(&printing::PrinterQuery::GetSettings, printer_query, base::Bind(&PrinterQuery::GetSettings,
params.ask_user_for_settings, base::Passed(&wc_observer), printer_query,
params.expected_page_count, params.has_selection, params.ask_user_for_settings,
params.margin_type, callback)); base::Passed(&wc_observer),
params.expected_page_count,
params.has_selection,
params.margin_type,
callback));
} else { } else {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
...@@ -289,10 +295,9 @@ void PrintingMessageFilter::GetPrintSettingsForRenderView( ...@@ -289,10 +295,9 @@ void PrintingMessageFilter::GetPrintSettingsForRenderView(
void PrintingMessageFilter::OnGetPrintSettingsFailed( void PrintingMessageFilter::OnGetPrintSettingsFailed(
const base::Closure& callback, const base::Closure& callback,
scoped_refptr<printing::PrinterQuery> printer_query) { scoped_refptr<PrinterQuery> printer_query) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
printer_query->GetSettingsDone(printing::PrintSettings(), printer_query->GetSettingsDone(PrintSettings(), PrintingContext::FAILED);
printing::PrintingContext::FAILED);
callback.Run(); callback.Run();
} }
...@@ -303,7 +308,7 @@ void PrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) { ...@@ -303,7 +308,7 @@ void PrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) {
void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_refptr<printing::PrinterQuery> printer_query; scoped_refptr<PrinterQuery> printer_query;
if (!profile_io_data_->printing_enabled()->GetValue()) { if (!profile_io_data_->printing_enabled()->GetValue()) {
// Reply with NULL query. // Reply with NULL query.
OnGetDefaultPrintSettingsReply(printer_query, reply_msg); OnGetDefaultPrintSettingsReply(printer_query, reply_msg);
...@@ -316,10 +321,10 @@ void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { ...@@ -316,10 +321,10 @@ void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
// Loads default settings. This is asynchronous, only the IPC message sender // Loads default settings. This is asynchronous, only the IPC message sender
// will hang until the settings are retrieved. // will hang until the settings are retrieved.
GetPrintSettingsForRenderViewParams params; GetPrintSettingsForRenderViewParams params;
params.ask_user_for_settings = printing::PrinterQuery::DEFAULTS; params.ask_user_for_settings = PrinterQuery::DEFAULTS;
params.expected_page_count = 0; params.expected_page_count = 0;
params.has_selection = false; params.has_selection = false;
params.margin_type = printing::DEFAULT_MARGINS; params.margin_type = DEFAULT_MARGINS;
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::Bind(&PrintingMessageFilter::GetPrintSettingsForRenderView, this, base::Bind(&PrintingMessageFilter::GetPrintSettingsForRenderView, this,
...@@ -330,11 +335,11 @@ void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { ...@@ -330,11 +335,11 @@ void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
} }
void PrintingMessageFilter::OnGetDefaultPrintSettingsReply( void PrintingMessageFilter::OnGetDefaultPrintSettingsReply(
scoped_refptr<printing::PrinterQuery> printer_query, scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
PrintMsg_Print_Params params; PrintMsg_Print_Params params;
if (!printer_query.get() || if (!printer_query.get() ||
printer_query->last_status() != printing::PrintingContext::OK) { printer_query->last_status() != PrintingContext::OK) {
params.Reset(); params.Reset();
} else { } else {
RenderParamsFromPrintSettings(printer_query->settings(), &params); RenderParamsFromPrintSettings(printer_query->settings(), &params);
...@@ -356,12 +361,12 @@ void PrintingMessageFilter::OnGetDefaultPrintSettingsReply( ...@@ -356,12 +361,12 @@ void PrintingMessageFilter::OnGetDefaultPrintSettingsReply(
void PrintingMessageFilter::OnScriptedPrint( void PrintingMessageFilter::OnScriptedPrint(
const PrintHostMsg_ScriptedPrint_Params& params, const PrintHostMsg_ScriptedPrint_Params& params,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
scoped_refptr<printing::PrinterQuery> printer_query = scoped_refptr<PrinterQuery> printer_query =
queue_->PopPrinterQuery(params.cookie); queue_->PopPrinterQuery(params.cookie);
if (!printer_query) if (!printer_query)
printer_query = queue_->CreatePrinterQuery(); printer_query = queue_->CreatePrinterQuery();
GetPrintSettingsForRenderViewParams settings_params; GetPrintSettingsForRenderViewParams settings_params;
settings_params.ask_user_for_settings = printing::PrinterQuery::ASK_USER; settings_params.ask_user_for_settings = PrinterQuery::ASK_USER;
settings_params.expected_page_count = params.expected_pages_count; settings_params.expected_page_count = params.expected_pages_count;
settings_params.has_selection = params.has_selection; settings_params.has_selection = params.has_selection;
settings_params.margin_type = params.margin_type; settings_params.margin_type = params.margin_type;
...@@ -376,7 +381,7 @@ void PrintingMessageFilter::OnScriptedPrint( ...@@ -376,7 +381,7 @@ void PrintingMessageFilter::OnScriptedPrint(
} }
void PrintingMessageFilter::OnScriptedPrintReply( void PrintingMessageFilter::OnScriptedPrintReply(
scoped_refptr<printing::PrinterQuery> printer_query, scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params; PrintMsg_PrintPages_Params params;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -384,14 +389,13 @@ void PrintingMessageFilter::OnScriptedPrintReply( ...@@ -384,14 +389,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
// |reply_msg| before we can get the routing ID for the Android code. // |reply_msg| before we can get the routing ID for the Android code.
int routing_id = reply_msg->routing_id(); int routing_id = reply_msg->routing_id();
#endif #endif
if (printer_query->last_status() != printing::PrintingContext::OK || if (printer_query->last_status() != PrintingContext::OK ||
!printer_query->settings().dpi()) { !printer_query->settings().dpi()) {
params.Reset(); params.Reset();
} else { } else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params); RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
params.params.document_cookie = printer_query->cookie(); params.params.document_cookie = printer_query->cookie();
params.pages = params.pages = PageRange::GetPages(printer_query->settings().ranges());
printing::PageRange::GetPages(printer_query->settings().ranges());
} }
PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params); PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params);
Send(reply_msg); Send(reply_msg);
...@@ -418,8 +422,8 @@ void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) { ...@@ -418,8 +422,8 @@ void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) {
content::WebContents* wc = GetWebContentsForRenderView(render_view_id); content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
if (!wc) if (!wc)
return; return;
printing::PrintViewManagerBasic* print_view_manager = PrintViewManagerBasic* print_view_manager =
printing::PrintViewManagerBasic::FromWebContents(wc); PrintViewManagerBasic::FromWebContents(wc);
print_view_manager->set_file_descriptor(base::FileDescriptor(fd, false)); print_view_manager->set_file_descriptor(base::FileDescriptor(fd, false));
} }
#endif #endif
...@@ -429,7 +433,7 @@ void PrintingMessageFilter::OnUpdatePrintSettings( ...@@ -429,7 +433,7 @@ void PrintingMessageFilter::OnUpdatePrintSettings(
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
scoped_ptr<base::DictionaryValue> new_settings(job_settings.DeepCopy()); scoped_ptr<base::DictionaryValue> new_settings(job_settings.DeepCopy());
scoped_refptr<printing::PrinterQuery> printer_query; scoped_refptr<PrinterQuery> printer_query;
if (!profile_io_data_->printing_enabled()->GetValue()) { if (!profile_io_data_->printing_enabled()->GetValue()) {
// Reply with NULL query. // Reply with NULL query.
OnUpdatePrintSettingsReply(printer_query, reply_msg); OnUpdatePrintSettingsReply(printer_query, reply_msg);
...@@ -445,17 +449,16 @@ void PrintingMessageFilter::OnUpdatePrintSettings( ...@@ -445,17 +449,16 @@ void PrintingMessageFilter::OnUpdatePrintSettings(
} }
void PrintingMessageFilter::OnUpdatePrintSettingsReply( void PrintingMessageFilter::OnUpdatePrintSettingsReply(
scoped_refptr<printing::PrinterQuery> printer_query, scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params; PrintMsg_PrintPages_Params params;
if (!printer_query.get() || if (!printer_query.get() ||
printer_query->last_status() != printing::PrintingContext::OK) { printer_query->last_status() != PrintingContext::OK) {
params.Reset(); params.Reset();
} else { } else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params); RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
params.params.document_cookie = printer_query->cookie(); params.params.document_cookie = printer_query->cookie();
params.pages = params.pages = PageRange::GetPages(printer_query->settings().ranges());
printing::PageRange::GetPages(printer_query->settings().ranges());
} }
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params); PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params);
Send(reply_msg); Send(reply_msg);
...@@ -478,3 +481,5 @@ void PrintingMessageFilter::OnCheckForCancel(int32 preview_ui_id, ...@@ -478,3 +481,5 @@ void PrintingMessageFilter::OnCheckForCancel(int32 preview_ui_id,
cancel); cancel);
} }
#endif #endif
} // namespace printing
...@@ -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,23 +86,20 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -85,23 +86,20 @@ 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<printing::PrinterQuery> printer_query); scoped_refptr<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
...@@ -109,8 +107,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -109,8 +107,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
// 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
...@@ -119,8 +116,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { ...@@ -119,8 +116,7 @@ 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)
...@@ -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