blob: 6559a2ff86e511ee858eae14c1a32f63c6cea161 [file] [log] [blame]
[email protected]87ab41e72012-01-04 18:45:111// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]73852b8f2010-05-14 00:38:122// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/printing/print_dialog_cloud.h"
[email protected]443e9312013-05-06 06:17:346
[email protected]73852b8f2010-05-14 00:38:127
[email protected]73852b8f2010-05-14 00:38:128#include "base/base64.h"
[email protected]ba4fc242011-10-04 18:56:569#include "base/bind.h"
10#include "base/bind_helpers.h"
[email protected]65c9d89a2011-04-13 21:02:3911#include "base/command_line.h"
[email protected]73852b8f2010-05-14 00:38:1212#include "base/file_util.h"
13#include "base/json/json_reader.h"
[email protected]3853a4c2013-02-11 17:15:5714#include "base/prefs/pref_service.h"
[email protected]e309f312013-06-07 21:50:0815#include "base/strings/utf_string_conversions.h"
[email protected]73852b8f2010-05-14 00:38:1216#include "base/values.h"
[email protected]70019152012-12-19 11:44:1917#include "chrome/browser/devtools/devtools_window.h"
[email protected]2e6389f2012-05-18 19:41:2518#include "chrome/browser/lifetime/application_lifetime.h"
[email protected]2283eead2010-09-29 23:17:3019#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
[email protected]443e9312013-05-06 06:17:3420#include "chrome/browser/printing/print_dialog_cloud_internal.h"
[email protected]8ecad5e2010-12-02 21:18:3321#include "chrome/browser/profiles/profile.h"
[email protected]e39027a2011-01-24 21:41:5422#include "chrome/browser/profiles/profile_manager.h"
[email protected]508326df2012-05-23 16:01:1923#include "chrome/browser/ui/browser_dialogs.h"
[email protected]65c9d89a2011-04-13 21:02:3924#include "chrome/common/chrome_switches.h"
[email protected]ea161da2010-11-02 21:57:3525#include "chrome/common/pref_names.h"
[email protected]1375e3ab2011-03-24 17:07:2226#include "chrome/common/print_messages.h"
[email protected]73852b8f2010-05-14 00:38:1227#include "chrome/common/url_constants.h"
[email protected]75fee372013-03-06 00:42:4428#include "components/user_prefs/pref_registry_syncable.h"
[email protected]c38831a12011-10-28 12:44:4929#include "content/public/browser/browser_thread.h"
[email protected]cdcb1dee2012-01-04 00:46:2030#include "content/public/browser/navigation_controller.h"
[email protected]022af742011-12-28 18:37:2531#include "content/public/browser/navigation_entry.h"
[email protected]6c2381d2011-10-19 02:52:5332#include "content/public/browser/notification_registrar.h"
33#include "content/public/browser/notification_source.h"
[email protected]0d6e9bd2011-10-18 04:29:1634#include "content/public/browser/notification_types.h"
[email protected]9c1662b2012-03-06 15:44:3335#include "content/public/browser/render_view_host.h"
[email protected]0ec4898e2011-12-30 21:09:2436#include "content/public/browser/web_contents.h"
[email protected]8643e6d2012-01-18 20:26:1037#include "content/public/browser/web_contents_view.h"
[email protected]01ec4ec2012-01-18 04:13:4738#include "content/public/browser/web_ui.h"
[email protected]fab55e72013-05-31 07:06:1839#include "webkit/common/webpreferences.h"
[email protected]520c2022012-03-15 00:13:1540
[email protected]88bfd25b2012-06-22 06:28:3341#if defined(USE_AURA)
42#include "ui/aura/root_window.h"
43#include "ui/aura/window.h"
44#endif
45
[email protected]520c2022012-03-15 00:13:1546#if defined(OS_WIN)
47#include "ui/base/win/foreground_helper.h"
48#endif
49
[email protected]73852b8f2010-05-14 00:38:1250// This module implements the UI support in Chrome for cloud printing.
51// This means hosting a dialog containing HTML/JavaScript and using
52// the published cloud print user interface integration APIs to get
53// page setup settings from the dialog contents and provide the
[email protected]a984bdf2011-03-15 20:17:1654// generated print data to the dialog contents for uploading to the
[email protected]73852b8f2010-05-14 00:38:1255// cloud print service.
56
57// Currently, the flow between these classes is as follows:
58
[email protected]a984bdf2011-03-15 20:17:1659// PrintDialogCloud::CreatePrintDialogForFile is called from
[email protected]73852b8f2010-05-14 00:38:1260// resource_message_filter_gtk.cc once the renderer has informed the
[email protected]a984bdf2011-03-15 20:17:1661// renderer host that print data generation into the renderer host provided
[email protected]032682b2011-01-12 22:05:0262// temp file has been completed. That call is on the FILE thread.
[email protected]73852b8f2010-05-14 00:38:1263// That, in turn, hops over to the UI thread to create an instance of
64// PrintDialogCloud.
65
66// The constructor for PrintDialogCloud creates a
[email protected]5835871a2012-04-25 21:56:5567// CloudPrintWebDialogDelegate and asks the current active browser to
[email protected]73852b8f2010-05-14 00:38:1268// show an HTML dialog using that class as the delegate. That class
[email protected]89f550b2011-06-08 18:34:0369// hands in the kChromeUICloudPrintResourcesURL as the URL to visit. That is
[email protected]80a8fad2011-01-29 04:02:3870// recognized by the GetWebUIFactoryFunction as a signal to create an
[email protected]02b5ccc2012-04-30 23:58:3171// ExternalWebDialogUI.
[email protected]73852b8f2010-05-14 00:38:1272
[email protected]5835871a2012-04-25 21:56:5573// CloudPrintWebDialogDelegate also temporarily owns a
[email protected]73852b8f2010-05-14 00:38:1274// CloudPrintFlowHandler, a class which is responsible for the actual
[email protected]a984bdf2011-03-15 20:17:1675// interactions with the dialog contents, including handing in the
[email protected]73852b8f2010-05-14 00:38:1276// print data and getting any page setup parameters that the dialog
77// contents provides. As part of bringing up the dialog,
[email protected]02b5ccc2012-04-30 23:58:3178// WebDialogUI::RenderViewCreated is called (an override of
[email protected]c39f9bf2011-02-12 00:43:5579// WebUI::RenderViewCreated). That routine, in turn, calls the
[email protected]36e12172011-02-08 23:46:0280// delegate's GetWebUIMessageHandlers routine, at which point the
[email protected]73852b8f2010-05-14 00:38:1281// ownership of the CloudPrintFlowHandler is handed over. A pointer
82// to the flow handler is kept to facilitate communication back and
83// forth between the two classes.
84
[email protected]c39f9bf2011-02-12 00:43:5585// The WebUI continues dialog bring-up, calling
[email protected]73852b8f2010-05-14 00:38:1286// CloudPrintFlowHandler::RegisterMessages. This is where the
87// additional object model capabilities are registered for the dialog
88// contents to use. It is also at this time that capabilities for the
89// dialog contents are adjusted to allow the dialog contents to close
90// the window. In addition, the pending URL is redirected to the
91// actual cloud print service URL. The flow controller also registers
92// for notification of when the dialog contents finish loading, which
[email protected]a984bdf2011-03-15 20:17:1693// is currently used to send the data to the dialog contents.
[email protected]73852b8f2010-05-14 00:38:1294
[email protected]a984bdf2011-03-15 20:17:1695// In order to send the data to the dialog contents, the flow
[email protected]73852b8f2010-05-14 00:38:1296// handler uses a CloudPrintDataSender. It creates one, letting it
[email protected]a984bdf2011-03-15 20:17:1697// know the name of the temporary file containing the data, and
[email protected]73852b8f2010-05-14 00:38:1298// posts the task of reading the file
99// (CloudPrintDataSender::ReadPrintDataFile) to the file thread. That
100// routine reads in the file, and then hops over to the IO thread to
101// send that data to the dialog contents.
102
103// When the dialog contents are finished (by either being cancelled or
104// hitting the print button), the delegate is notified, and responds
105// that the dialog should be closed, at which point things are torn
106// down and released.
107
[email protected]631bb742011-11-02 11:29:39108using content::BrowserThread;
[email protected]c5eed492012-01-04 17:07:50109using content::NavigationController;
[email protected]10f417c52011-12-28 21:04:23110using content::NavigationEntry;
[email protected]eaabba22012-03-07 15:02:11111using content::RenderViewHost;
[email protected]a81343d232011-12-27 07:39:20112using content::WebContents;
[email protected]26e2632a2011-12-31 04:02:55113using content::WebUIMessageHandler;
[email protected]20c07f8e2012-05-31 08:43:14114using ui::WebDialogDelegate;
[email protected]631bb742011-11-02 11:29:39115
[email protected]681958c2013-02-21 13:48:14116const int kDefaultWidth = 912;
117const int kDefaultHeight = 633;
118
[email protected]73852b8f2010-05-14 00:38:12119namespace internal_cloud_print_helpers {
120
[email protected]73852b8f2010-05-14 00:38:12121// From the JSON parsed value, get the entries for the page setup
122// parameters.
123bool GetPageSetupParameters(const std::string& json,
[email protected]1375e3ab2011-03-24 17:07:22124 PrintMsg_Print_Params& parameters) {
[email protected]cd5785752012-04-11 00:15:41125 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
[email protected]73852b8f2010-05-14 00:38:12126 DLOG_IF(ERROR, (!parsed_value.get() ||
127 !parsed_value->IsType(Value::TYPE_DICTIONARY)))
128 << "PageSetup call didn't have expected contents";
129 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
130 return false;
131
132 bool result = true;
133 DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get());
[email protected]05c7da62011-05-05 17:23:56134 result &= params->GetDouble("dpi", &parameters.dpi);
135 result &= params->GetDouble("min_shrink", &parameters.min_shrink);
136 result &= params->GetDouble("max_shrink", &parameters.max_shrink);
[email protected]a65175d2010-08-17 04:00:57137 result &= params->GetBoolean("selection_only", &parameters.selection_only);
[email protected]73852b8f2010-05-14 00:38:12138 return result;
139}
140
[email protected]536f86a2013-11-23 01:24:56141base::string16 GetSwitchValueString16(const CommandLine& command_line,
142 const char* switchName) {
[email protected]31662202013-03-23 19:10:54143#if defined(OS_WIN)
[email protected]536f86a2013-11-23 01:24:56144 return command_line.GetSwitchValueNative(switchName);
[email protected]e8368e92011-08-20 04:05:56145#elif defined(OS_POSIX)
146 // POSIX Command line string types are different.
147 CommandLine::StringType native_switch_val;
148 native_switch_val = command_line.GetSwitchValueASCII(switchName);
149 // Convert the ASCII string to UTF16 to prepare to pass.
[email protected]536f86a2013-11-23 01:24:56150 return base::ASCIIToUTF16(native_switch_val);
[email protected]e8368e92011-08-20 04:05:56151#endif
152}
153
[email protected]73852b8f2010-05-14 00:38:12154void CloudPrintDataSenderHelper::CallJavascriptFunction(
[email protected]536f86a2013-11-23 01:24:56155 const std::string& function_name, const Value& arg1, const Value& arg2) {
156 web_ui_->CallJavascriptFunction(function_name, arg1, arg2);
[email protected]e8368e92011-08-20 04:05:56157}
158
[email protected]73852b8f2010-05-14 00:38:12159// Clears out the pointer we're using to communicate. Either routine is
160// potentially expensive enough that stopping whatever is in progress
161// is worth it.
162void CloudPrintDataSender::CancelPrintDataFile() {
[email protected]20305ec2011-01-21 04:55:52163 base::AutoLock lock(lock_);
[email protected]73852b8f2010-05-14 00:38:12164 // We don't own helper, it was passed in to us, so no need to
165 // delete, just let it go.
166 helper_ = NULL;
167}
168
[email protected]38e08982010-10-22 17:28:43169CloudPrintDataSender::CloudPrintDataSender(CloudPrintDataSenderHelper* helper,
[email protected]a984bdf2011-03-15 20:17:16170 const string16& print_job_title,
[email protected]e8368e92011-08-20 04:05:56171 const string16& print_ticket,
[email protected]a9723e12013-03-05 04:02:45172 const std::string& file_type,
173 const base::RefCountedMemory* data)
[email protected]38e08982010-10-22 17:28:43174 : helper_(helper),
[email protected]a984bdf2011-03-15 20:17:16175 print_job_title_(print_job_title),
[email protected]e8368e92011-08-20 04:05:56176 print_ticket_(print_ticket),
[email protected]a9723e12013-03-05 04:02:45177 file_type_(file_type),
178 data_(data) {
[email protected]38e08982010-10-22 17:28:43179}
180
181CloudPrintDataSender::~CloudPrintDataSender() {}
182
[email protected]73852b8f2010-05-14 00:38:12183// We have the data in hand that needs to be pushed into the dialog
184// contents; do so from the IO thread.
185
186// TODO(scottbyer): If the print data ends up being larger than the
187// upload limit (currently 10MB), what we need to do is upload that
188// large data to google docs and set the URL in the printing
189// JavaScript to that location, and make sure it gets deleted when not
190// needed. - 4/1/2010
[email protected]a9723e12013-03-05 04:02:45191void CloudPrintDataSender::SendPrintData() {
[email protected]ba4f1132010-10-09 02:02:35192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
[email protected]5173de8b2013-06-02 21:16:02193 if (!data_.get() || !data_->size())
[email protected]a9723e12013-03-05 04:02:45194 return;
195
196 std::string base64_data;
197 base::Base64Encode(
198 base::StringPiece(reinterpret_cast<const char*>(data_->front()),
199 data_->size()),
200 &base64_data);
[email protected]a9723e12013-03-05 04:02:45201 std::string header("data:");
202 header.append(file_type_);
203 header.append(";base64,");
204 base64_data.insert(0, header);
205
[email protected]20305ec2011-01-21 04:55:52206 base::AutoLock lock(lock_);
[email protected]a9723e12013-03-05 04:02:45207 if (helper_) {
[email protected]536f86a2013-11-23 01:24:56208 base::StringValue title(print_job_title_);
209 base::StringValue ticket(print_ticket_);
[email protected]e8368e92011-08-20 04:05:56210 // TODO(abodenha): Change Javascript call to pass in print ticket
211 // after server side support is added. Add test for it.
[email protected]73852b8f2010-05-14 00:38:12212
213 // Send the print data to the dialog contents. The JavaScript
214 // function is a preliminary API for prototyping purposes and is
215 // subject to change.
[email protected]536f86a2013-11-23 01:24:56216 helper_->CallJavascriptFunction(
217 "printApp._printDataUrl", base::StringValue(base64_data), title);
[email protected]73852b8f2010-05-14 00:38:12218 }
219}
220
221
[email protected]a9723e12013-03-05 04:02:45222CloudPrintFlowHandler::CloudPrintFlowHandler(const base::RefCountedMemory* data,
[email protected]a984bdf2011-03-15 20:17:16223 const string16& print_job_title,
[email protected]e8368e92011-08-20 04:05:56224 const string16& print_ticket,
[email protected]4cd49022012-01-19 20:37:37225 const std::string& file_type,
226 bool close_after_signin,
227 const base::Closure& callback)
[email protected]c7bf7452011-09-12 21:31:50228 : dialog_delegate_(NULL),
[email protected]a9723e12013-03-05 04:02:45229 data_(data),
[email protected]a984bdf2011-03-15 20:17:16230 print_job_title_(print_job_title),
[email protected]e8368e92011-08-20 04:05:56231 print_ticket_(print_ticket),
[email protected]4cd49022012-01-19 20:37:37232 file_type_(file_type),
233 close_after_signin_(close_after_signin),
234 callback_(callback) {
[email protected]38e08982010-10-22 17:28:43235}
236
237CloudPrintFlowHandler::~CloudPrintFlowHandler() {
238 // This will also cancel any task in flight.
239 CancelAnyRunningTask();
240}
241
242
[email protected]73852b8f2010-05-14 00:38:12243void CloudPrintFlowHandler::SetDialogDelegate(
[email protected]5835871a2012-04-25 21:56:55244 CloudPrintWebDialogDelegate* delegate) {
[email protected]7b748982011-02-14 19:28:23245 // Even if setting a new WebUI, it means any previous task needs
[email protected]a2c92a1c2012-04-03 12:32:14246 // to be canceled, its now invalid.
[email protected]ba4f1132010-10-09 02:02:35247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]73852b8f2010-05-14 00:38:12248 CancelAnyRunningTask();
249 dialog_delegate_ = delegate;
250}
251
252// Cancels any print data sender we have in flight and removes our
253// reference to it, so when the task that is calling it finishes and
[email protected]a2c92a1c2012-04-03 12:32:14254// removes its reference, it goes away.
[email protected]73852b8f2010-05-14 00:38:12255void CloudPrintFlowHandler::CancelAnyRunningTask() {
[email protected]ba4f1132010-10-09 02:02:35256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]73852b8f2010-05-14 00:38:12257 if (print_data_sender_.get()) {
258 print_data_sender_->CancelPrintDataFile();
259 print_data_sender_ = NULL;
260 }
261}
262
[email protected]73852b8f2010-05-14 00:38:12263void CloudPrintFlowHandler::RegisterMessages() {
[email protected]73852b8f2010-05-14 00:38:12264 // TODO(scottbyer) - This is where we will register messages for the
265 // UI JS to use. Needed: Call to update page setup parameters.
[email protected]46adf7ff2011-12-30 00:53:09266 web_ui()->RegisterMessageCallback("ShowDebugger",
[email protected]ba4fc242011-10-04 18:56:56267 base::Bind(&CloudPrintFlowHandler::HandleShowDebugger,
268 base::Unretained(this)));
[email protected]46adf7ff2011-12-30 00:53:09269 web_ui()->RegisterMessageCallback("SendPrintData",
[email protected]ba4fc242011-10-04 18:56:56270 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData,
271 base::Unretained(this)));
[email protected]46adf7ff2011-12-30 00:53:09272 web_ui()->RegisterMessageCallback("SetPageParameters",
[email protected]ba4fc242011-10-04 18:56:56273 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters,
274 base::Unretained(this)));
[email protected]73852b8f2010-05-14 00:38:12275
[email protected]0eb25c42011-08-11 14:50:14276 // Register for appropriate notifications, and re-direct the URL
277 // to the real server URL, now that we've gotten an HTML dialog
278 // going.
[email protected]c5eed492012-01-04 17:07:50279 NavigationController* controller =
[email protected]01ec4ec2012-01-18 04:13:47280 &web_ui()->GetWebContents()->GetController();
[email protected]10f417c52011-12-28 21:04:23281 NavigationEntry* pending_entry = controller->GetPendingEntry();
[email protected]0eb25c42011-08-11 14:50:14282 if (pending_entry) {
[email protected]46adf7ff2011-12-30 00:53:09283 Profile* profile = Profile::FromWebUI(web_ui());
[email protected]4cd49022012-01-19 20:37:37284 if (close_after_signin_) {
285 pending_entry->SetURL(
286 CloudPrintURL(profile).GetCloudPrintSigninURL());
287 } else {
288 pending_entry->SetURL(
289 CloudPrintURL(profile).GetCloudPrintServiceDialogURL());
290 }
[email protected]73852b8f2010-05-14 00:38:12291 }
[email protected]0eb25c42011-08-11 14:50:14292 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
[email protected]c5eed492012-01-04 17:07:50293 content::Source<NavigationController>(controller));
[email protected]57c8cf22013-03-02 16:50:00294 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
295 content::Source<NavigationController>(controller));
[email protected]73852b8f2010-05-14 00:38:12296}
297
[email protected]6c2381d2011-10-19 02:52:53298void CloudPrintFlowHandler::Observe(
299 int type,
300 const content::NotificationSource& source,
301 const content::NotificationDetails& details) {
[email protected]57c8cf22013-03-02 16:50:00302 switch (type) {
303 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
304 NavigationEntry* entry =
305 web_ui()->GetWebContents()->GetController().GetActiveEntry();
306 if (entry)
307 NavigationToURLDidCloseDialog(entry->GetURL());
308 break;
[email protected]20c52d22011-06-20 22:42:42309 }
[email protected]57c8cf22013-03-02 16:50:00310 case content::NOTIFICATION_LOAD_STOP: {
[email protected]57c8cf22013-03-02 16:50:00311 GURL url = web_ui()->GetWebContents()->GetURL();
[email protected]6e536cdf2013-05-09 04:49:52312 if (IsCloudPrintDialogUrl(url)) {
313 // Take the opportunity to set some (minimal) additional
314 // script permissions required for the web UI.
[email protected]57c8cf22013-03-02 16:50:00315 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost();
316 if (rvh) {
[email protected]3184f90b2013-05-01 18:17:53317 WebPreferences webkit_prefs = rvh->GetWebkitPreferences();
[email protected]57c8cf22013-03-02 16:50:00318 webkit_prefs.allow_scripts_to_close_windows = true;
319 rvh->UpdateWebkitPreferences(webkit_prefs);
320 } else {
321 NOTREACHED();
322 }
[email protected]6e536cdf2013-05-09 04:49:52323 // Choose one or the other. If you need to debug, bring up the
324 // debugger. You can then use the various chrome.send()
325 // registrations above to kick of the various function calls,
326 // including chrome.send("SendPrintData") in the javaScript
327 // console and watch things happen with:
328 // HandleShowDebugger(NULL);
329 HandleSendPrintData(NULL);
[email protected]57c8cf22013-03-02 16:50:00330 }
[email protected]57c8cf22013-03-02 16:50:00331 break;
332 }
[email protected]73852b8f2010-05-14 00:38:12333 }
334}
335
[email protected]88942a22010-08-19 20:34:43336void CloudPrintFlowHandler::HandleShowDebugger(const ListValue* args) {
[email protected]73852b8f2010-05-14 00:38:12337 ShowDebugger();
338}
339
340void CloudPrintFlowHandler::ShowDebugger() {
[email protected]46adf7ff2011-12-30 00:53:09341 if (web_ui()) {
[email protected]01ec4ec2012-01-18 04:13:47342 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost();
[email protected]73852b8f2010-05-14 00:38:12343 if (rvh)
[email protected]aebdd072011-07-07 12:36:59344 DevToolsWindow::OpenDevToolsWindow(rvh);
[email protected]73852b8f2010-05-14 00:38:12345 }
346}
347
348scoped_refptr<CloudPrintDataSender>
349CloudPrintFlowHandler::CreateCloudPrintDataSender() {
[email protected]46adf7ff2011-12-30 00:53:09350 DCHECK(web_ui());
351 print_data_helper_.reset(new CloudPrintDataSenderHelper(web_ui()));
[email protected]a9723e12013-03-05 04:02:45352 scoped_refptr<CloudPrintDataSender> sender(
[email protected]5173de8b2013-06-02 21:16:02353 new CloudPrintDataSender(print_data_helper_.get(),
354 print_job_title_,
355 print_ticket_,
356 file_type_,
357 data_.get()));
[email protected]a9723e12013-03-05 04:02:45358 return sender;
[email protected]73852b8f2010-05-14 00:38:12359}
360
[email protected]88942a22010-08-19 20:34:43361void CloudPrintFlowHandler::HandleSendPrintData(const ListValue* args) {
[email protected]ba4f1132010-10-09 02:02:35362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]73852b8f2010-05-14 00:38:12363 // This will cancel any ReadPrintDataFile() or SendPrintDataFile()
364 // requests in flight (this is anticipation of when setting page
365 // setup parameters becomes asynchronous and may be set while some
366 // data is in flight). Then we can clear out the print data.
367 CancelAnyRunningTask();
[email protected]46adf7ff2011-12-30 00:53:09368 if (web_ui()) {
[email protected]73852b8f2010-05-14 00:38:12369 print_data_sender_ = CreateCloudPrintDataSender();
[email protected]3e2dd4fa2011-11-10 06:06:40370 BrowserThread::PostTask(
[email protected]a9723e12013-03-05 04:02:45371 BrowserThread::IO, FROM_HERE,
372 base::Bind(&CloudPrintDataSender::SendPrintData, print_data_sender_));
[email protected]73852b8f2010-05-14 00:38:12373 }
374}
375
[email protected]88942a22010-08-19 20:34:43376void CloudPrintFlowHandler::HandleSetPageParameters(const ListValue* args) {
[email protected]036056a32011-03-03 21:05:01377 std::string json;
[email protected]e675f7b2011-06-22 17:32:12378 bool ret = args->GetString(0, &json);
379 if (!ret || json.empty()) {
[email protected]036056a32011-03-03 21:05:01380 NOTREACHED() << "Empty json string";
[email protected]73852b8f2010-05-14 00:38:12381 return;
[email protected]036056a32011-03-03 21:05:01382 }
[email protected]73852b8f2010-05-14 00:38:12383
384 // These are backstop default values - 72 dpi to match the screen,
385 // 8.5x11 inch paper with margins subtracted (1/4 inch top, left,
386 // right and 0.56 bottom), and the min page shrink and max page
387 // shrink values appear all over the place with no explanation.
388
389 // TODO(scottbyer): Get a Linux/ChromeOS edge for PrintSettings
390 // working so that we can get the default values from there. Fix up
391 // PrintWebViewHelper to do the same.
392 const int kDPI = 72;
393 const int kWidth = static_cast<int>((8.5-0.25-0.25)*kDPI);
394 const int kHeight = static_cast<int>((11-0.25-0.56)*kDPI);
395 const double kMinPageShrink = 1.25;
396 const double kMaxPageShrink = 2.0;
397
[email protected]1375e3ab2011-03-24 17:07:22398 PrintMsg_Print_Params default_settings;
[email protected]10980442011-12-04 22:33:05399 default_settings.content_size = gfx::Size(kWidth, kHeight);
[email protected]732b8132012-01-10 23:17:32400 default_settings.printable_area = gfx::Rect(0, 0, kWidth, kHeight);
[email protected]73852b8f2010-05-14 00:38:12401 default_settings.dpi = kDPI;
402 default_settings.min_shrink = kMinPageShrink;
403 default_settings.max_shrink = kMaxPageShrink;
404 default_settings.desired_dpi = kDPI;
405 default_settings.document_cookie = 0;
406 default_settings.selection_only = false;
[email protected]718af822011-08-12 22:11:33407 default_settings.preview_request_id = 0;
408 default_settings.is_first_request = true;
[email protected]732b8132012-01-10 23:17:32409 default_settings.print_to_pdf = false;
[email protected]73852b8f2010-05-14 00:38:12410
411 if (!GetPageSetupParameters(json, default_settings)) {
412 NOTREACHED();
413 return;
414 }
415
416 // TODO(scottbyer) - Here is where we would kick the originating
417 // renderer thread with these new parameters in order to get it to
[email protected]a984bdf2011-03-15 20:17:16418 // re-generate the PDF data and hand it back to us. window.print() is
[email protected]73852b8f2010-05-14 00:38:12419 // currently synchronous, so there's a lot of work to do to get to
420 // that point.
421}
422
[email protected]ea161da2010-11-02 21:57:35423void CloudPrintFlowHandler::StoreDialogClientSize() const {
[email protected]01ec4ec2012-01-18 04:13:47424 if (web_ui() && web_ui()->GetWebContents() &&
425 web_ui()->GetWebContents()->GetView()) {
426 gfx::Size size = web_ui()->GetWebContents()->GetView()->GetContainerSize();
[email protected]46adf7ff2011-12-30 00:53:09427 Profile* profile = Profile::FromWebUI(web_ui());
[email protected]0eb25c42011-08-11 14:50:14428 profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogWidth,
429 size.width());
430 profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogHeight,
431 size.height());
[email protected]ea161da2010-11-02 21:57:35432 }
433}
434
[email protected]a911c4e2012-10-12 00:37:57435bool CloudPrintFlowHandler::NavigationToURLDidCloseDialog(const GURL& url) {
436 if (close_after_signin_) {
[email protected]6e536cdf2013-05-09 04:49:52437 if (IsCloudPrintDialogUrl(url)) {
[email protected]a911c4e2012-10-12 00:37:57438 StoreDialogClientSize();
439 web_ui()->GetWebContents()->GetRenderViewHost()->ClosePage();
440 callback_.Run();
441 return true;
442 }
443 }
444 return false;
445}
446
[email protected]6e536cdf2013-05-09 04:49:52447bool CloudPrintFlowHandler::IsCloudPrintDialogUrl(const GURL& url) {
448 GURL cloud_print_url =
449 CloudPrintURL(Profile::FromWebUI(web_ui())).GetCloudPrintServiceURL();
450 return url.host() == cloud_print_url.host() &&
451 StartsWithASCII(url.path(), cloud_print_url.path(), false) &&
452 url.scheme() == cloud_print_url.scheme();
453}
454
[email protected]5835871a2012-04-25 21:56:55455CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate(
[email protected]b5b79d72012-05-24 19:42:28456 content::BrowserContext* browser_context,
457 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45458 const base::RefCountedMemory* data,
[email protected]9848c7e2010-06-03 16:06:56459 const std::string& json_arguments,
[email protected]e39027a2011-01-24 21:41:54460 const string16& print_job_title,
[email protected]e8368e92011-08-20 04:05:56461 const string16& print_ticket,
[email protected]a984bdf2011-03-15 20:17:16462 const std::string& file_type,
[email protected]4cd49022012-01-19 20:37:37463 bool close_after_signin,
464 const base::Closure& callback)
[email protected]a9723e12013-03-05 04:02:45465 : flow_handler_(
466 new CloudPrintFlowHandler(data, print_job_title, print_ticket,
467 file_type, close_after_signin, callback)),
[email protected]b5b79d72012-05-24 19:42:28468 modal_parent_(modal_parent),
[email protected]6ddda232011-04-22 15:41:47469 owns_flow_handler_(true),
[email protected]b5b79d72012-05-24 19:42:28470 keep_alive_when_non_modal_(true) {
471 Init(browser_context, json_arguments);
[email protected]73852b8f2010-05-14 00:38:12472}
473
[email protected]05acb55472011-02-03 00:11:07474// For unit testing.
[email protected]5835871a2012-04-25 21:56:55475CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate(
[email protected]73852b8f2010-05-14 00:38:12476 CloudPrintFlowHandler* flow_handler,
[email protected]a9723e12013-03-05 04:02:45477 const std::string& json_arguments)
478 : flow_handler_(flow_handler),
[email protected]b5b79d72012-05-24 19:42:28479 modal_parent_(NULL),
480 owns_flow_handler_(true),
481 keep_alive_when_non_modal_(false) {
482 Init(NULL, json_arguments);
[email protected]73852b8f2010-05-14 00:38:12483}
484
[email protected]b5b79d72012-05-24 19:42:28485// Returns the persisted width/height for the print dialog.
486void GetDialogWidthAndHeightFromPrefs(content::BrowserContext* browser_context,
487 int* width,
488 int* height) {
[email protected]b5b79d72012-05-24 19:42:28489 if (!browser_context) {
490 *width = kDefaultWidth;
491 *height = kDefaultHeight;
492 return;
493 }
494
[email protected]c753f142013-02-10 13:14:04495 PrefService* prefs = Profile::FromBrowserContext(browser_context)->GetPrefs();
[email protected]c753f142013-02-10 13:14:04496 *width = prefs->GetInteger(prefs::kCloudPrintDialogWidth);
497 *height = prefs->GetInteger(prefs::kCloudPrintDialogHeight);
[email protected]b5b79d72012-05-24 19:42:28498}
499
500void CloudPrintWebDialogDelegate::Init(content::BrowserContext* browser_context,
[email protected]5835871a2012-04-25 21:56:55501 const std::string& json_arguments) {
[email protected]73852b8f2010-05-14 00:38:12502 // This information is needed to show the dialog HTML content.
[email protected]ba4f1132010-10-09 02:02:35503 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]b5b79d72012-05-24 19:42:28504
[email protected]89f550b2011-06-08 18:34:03505 params_.url = GURL(chrome::kChromeUICloudPrintResourcesURL);
[email protected]b5b79d72012-05-24 19:42:28506 GetDialogWidthAndHeightFromPrefs(browser_context,
507 &params_.width,
508 &params_.height);
[email protected]73852b8f2010-05-14 00:38:12509 params_.json_input = json_arguments;
510
511 flow_handler_->SetDialogDelegate(this);
[email protected]e39027a2011-01-24 21:41:54512 // If we're not modal we can show the dialog with no browser.
513 // We need this to keep Chrome alive while our dialog is up.
[email protected]b5b79d72012-05-24 19:42:28514 if (!modal_parent_ && keep_alive_when_non_modal_)
[email protected]313fce12013-01-30 17:09:04515 chrome::StartKeepAlive();
[email protected]73852b8f2010-05-14 00:38:12516}
517
[email protected]5835871a2012-04-25 21:56:55518CloudPrintWebDialogDelegate::~CloudPrintWebDialogDelegate() {
[email protected]73852b8f2010-05-14 00:38:12519 // If the flow_handler_ is about to outlive us because we don't own
[email protected]a2c92a1c2012-04-03 12:32:14520 // it anymore, we need to have it remove its reference to us.
[email protected]ba4f1132010-10-09 02:02:35521 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]73852b8f2010-05-14 00:38:12522 flow_handler_->SetDialogDelegate(NULL);
523 if (owns_flow_handler_) {
524 delete flow_handler_;
525 }
526}
527
[email protected]5835871a2012-04-25 21:56:55528ui::ModalType CloudPrintWebDialogDelegate::GetDialogModalType() const {
[email protected]b5b79d72012-05-24 19:42:28529 return modal_parent_ ? ui::MODAL_TYPE_WINDOW : ui::MODAL_TYPE_NONE;
[email protected]73852b8f2010-05-14 00:38:12530}
531
[email protected]5835871a2012-04-25 21:56:55532string16 CloudPrintWebDialogDelegate::GetDialogTitle() const {
[email protected]bdae5c12011-08-05 21:49:06533 return string16();
[email protected]73852b8f2010-05-14 00:38:12534}
535
[email protected]5835871a2012-04-25 21:56:55536GURL CloudPrintWebDialogDelegate::GetDialogContentURL() const {
[email protected]73852b8f2010-05-14 00:38:12537 return params_.url;
538}
539
[email protected]5835871a2012-04-25 21:56:55540void CloudPrintWebDialogDelegate::GetWebUIMessageHandlers(
[email protected]36e12172011-02-08 23:46:02541 std::vector<WebUIMessageHandler*>* handlers) const {
[email protected]73852b8f2010-05-14 00:38:12542 handlers->push_back(flow_handler_);
543 // We don't own flow_handler_ anymore, but it sticks around until at
544 // least right after OnDialogClosed() is called (and this object is
545 // destroyed).
546 owns_flow_handler_ = false;
547}
548
[email protected]5835871a2012-04-25 21:56:55549void CloudPrintWebDialogDelegate::GetDialogSize(gfx::Size* size) const {
[email protected]73852b8f2010-05-14 00:38:12550 size->set_width(params_.width);
551 size->set_height(params_.height);
552}
553
[email protected]5835871a2012-04-25 21:56:55554std::string CloudPrintWebDialogDelegate::GetDialogArgs() const {
[email protected]73852b8f2010-05-14 00:38:12555 return params_.json_input;
556}
557
[email protected]5835871a2012-04-25 21:56:55558void CloudPrintWebDialogDelegate::OnDialogClosed(
[email protected]73852b8f2010-05-14 00:38:12559 const std::string& json_retval) {
[email protected]ea161da2010-11-02 21:57:35560 // Get the final dialog size and store it.
561 flow_handler_->StoreDialogClientSize();
[email protected]6ddda232011-04-22 15:41:47562
[email protected]e39027a2011-01-24 21:41:54563 // If we're modal we can show the dialog with no browser.
564 // End the keep-alive so that Chrome can exit.
[email protected]129bedf2013-11-20 07:34:03565 if (!modal_parent_ && keep_alive_when_non_modal_) {
566 // Post to prevent recursive call tho this function.
567 base::MessageLoop::current()->PostTask(FROM_HERE,
568 base::Bind(&chrome::EndKeepAlive));
569 }
[email protected]73852b8f2010-05-14 00:38:12570 delete this;
571}
572
[email protected]5835871a2012-04-25 21:56:55573void CloudPrintWebDialogDelegate::OnCloseContents(WebContents* source,
574 bool* out_close_dialog) {
[email protected]18137e02010-05-25 21:10:35575 if (out_close_dialog)
576 *out_close_dialog = true;
577}
578
[email protected]5835871a2012-04-25 21:56:55579bool CloudPrintWebDialogDelegate::ShouldShowDialogTitle() const {
[email protected]ea161da2010-11-02 21:57:35580 return false;
581}
582
[email protected]5835871a2012-04-25 21:56:55583bool CloudPrintWebDialogDelegate::HandleContextMenu(
[email protected]35be7ec2012-02-12 20:42:51584 const content::ContextMenuParams& params) {
[email protected]34478212011-04-19 01:35:46585 return true;
586}
587
[email protected]a911c4e2012-10-12 00:37:57588bool CloudPrintWebDialogDelegate::HandleOpenURLFromTab(
589 content::WebContents* source,
590 const content::OpenURLParams& params,
591 content::WebContents** out_new_contents) {
592 return flow_handler_->NavigationToURLDidCloseDialog(params.url);
593}
594
[email protected]6085c70d2011-03-22 22:51:07595// Called from the UI thread, starts up the dialog.
[email protected]b5b79d72012-05-24 19:42:28596void CreateDialogImpl(content::BrowserContext* browser_context,
597 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45598 const base::RefCountedMemory* data,
[email protected]6085c70d2011-03-22 22:51:07599 const string16& print_job_title,
[email protected]e8368e92011-08-20 04:05:56600 const string16& print_ticket,
[email protected]6085c70d2011-03-22 22:51:07601 const std::string& file_type,
[email protected]4cd49022012-01-19 20:37:37602 bool close_after_signin,
603 const base::Closure& callback) {
[email protected]ba4f1132010-10-09 02:02:35604 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]5835871a2012-04-25 21:56:55605 WebDialogDelegate* dialog_delegate =
606 new internal_cloud_print_helpers::CloudPrintWebDialogDelegate(
[email protected]a9723e12013-03-05 04:02:45607 browser_context, modal_parent, data, std::string(), print_job_title,
608 print_ticket, file_type, close_after_signin, callback);
[email protected]88bfd25b2012-06-22 06:28:33609#if defined(OS_WIN)
610 gfx::NativeWindow window =
611#endif
[email protected]87586fb72012-07-02 13:15:02612 chrome::ShowWebDialog(modal_parent,
613 Profile::FromBrowserContext(browser_context),
614 dialog_delegate);
[email protected]88bfd25b2012-06-22 06:28:33615#if defined(OS_WIN)
[email protected]a9723e12013-03-05 04:02:45616 if (window) {
[email protected]88bfd25b2012-06-22 06:28:33617 HWND dialog_handle;
618#if defined(USE_AURA)
[email protected]228f0f02013-11-15 05:58:36619 dialog_handle = window->GetDispatcher()->host()->GetAcceleratedWidget();
[email protected]88bfd25b2012-06-22 06:28:33620#else
621 dialog_handle = window;
622#endif
623 if (::GetForegroundWindow() != dialog_handle) {
624 ui::ForegroundHelper::SetForeground(dialog_handle);
625 }
626 }
627#endif
[email protected]73852b8f2010-05-14 00:38:12628}
[email protected]6085c70d2011-03-22 22:51:07629
[email protected]b5b79d72012-05-24 19:42:28630void CreateDialogSigninImpl(content::BrowserContext* browser_context,
631 gfx::NativeWindow modal_parent,
632 const base::Closure& callback) {
[email protected]a9723e12013-03-05 04:02:45633 CreateDialogImpl(browser_context, modal_parent, NULL, string16(),
634 string16(), std::string(), true, callback);
[email protected]4cd49022012-01-19 20:37:37635}
636
[email protected]a9723e12013-03-05 04:02:45637void CreateDialogForFileImpl(content::BrowserContext* browser_context,
638 gfx::NativeWindow modal_parent,
639 const base::FilePath& path_to_file,
640 const string16& print_job_title,
641 const string16& print_ticket,
642 const std::string& file_type,
643 bool delete_on_close) {
644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
645 scoped_refptr<base::RefCountedMemory> data;
646 int64 file_size = 0;
[email protected]56285702013-12-04 18:22:49647 if (base::GetFileSize(path_to_file, &file_size) && file_size != 0) {
[email protected]a9723e12013-03-05 04:02:45648 std::string file_data;
649 if (file_size < kuint32max) {
650 file_data.reserve(static_cast<unsigned int>(file_size));
651 } else {
652 DLOG(WARNING) << " print data file too large to reserve space";
653 }
[email protected]82f84b92013-08-30 18:23:50654 if (base::ReadFileToString(path_to_file, &file_data)) {
[email protected]a9723e12013-03-05 04:02:45655 data = base::RefCountedString::TakeString(&file_data);
656 }
657 }
658 // Proceed even for empty data to simplify testing.
659 BrowserThread::PostTask(
660 BrowserThread::UI, FROM_HERE,
661 base::Bind(&print_dialog_cloud::CreatePrintDialogForBytes,
662 browser_context, modal_parent, data, print_job_title,
663 print_ticket, file_type));
664 if (delete_on_close)
[email protected]dd3aa792013-07-16 19:10:23665 base::DeleteFile(path_to_file, false);
[email protected]6ddda232011-04-22 15:41:47666}
667
[email protected]6085c70d2011-03-22 22:51:07668} // namespace internal_cloud_print_helpers
669
670namespace print_dialog_cloud {
671
[email protected]37ca3fe02013-07-05 15:32:44672void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
[email protected]681958c2013-02-21 13:48:14673 registry->RegisterIntegerPref(
674 prefs::kCloudPrintDialogWidth,
675 kDefaultWidth,
[email protected]443e9312013-05-06 06:17:34676 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]681958c2013-02-21 13:48:14677 registry->RegisterIntegerPref(
678 prefs::kCloudPrintDialogHeight,
679 kDefaultHeight,
[email protected]443e9312013-05-06 06:17:34680 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]681958c2013-02-21 13:48:14681}
682
[email protected]6085c70d2011-03-22 22:51:07683// Called on the FILE or UI thread. This is the main entry point into creating
684// the dialog.
685
[email protected]b5b79d72012-05-24 19:42:28686void CreatePrintDialogForFile(content::BrowserContext* browser_context,
687 gfx::NativeWindow modal_parent,
[email protected]650b2d52013-02-10 03:41:45688 const base::FilePath& path_to_file,
[email protected]6085c70d2011-03-22 22:51:07689 const string16& print_job_title,
[email protected]e8368e92011-08-20 04:05:56690 const string16& print_ticket,
[email protected]6085c70d2011-03-22 22:51:07691 const std::string& file_type,
[email protected]d955fc92011-09-19 20:49:03692 bool delete_on_close) {
[email protected]6085c70d2011-03-22 22:51:07693 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE) ||
694 BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]6085c70d2011-03-22 22:51:07695 BrowserThread::PostTask(
[email protected]a9723e12013-03-05 04:02:45696 BrowserThread::FILE, FROM_HERE,
697 base::Bind(&internal_cloud_print_helpers::CreateDialogForFileImpl,
[email protected]b5b79d72012-05-24 19:42:28698 browser_context, modal_parent, path_to_file, print_job_title,
699 print_ticket, file_type, delete_on_close));
[email protected]d955fc92011-09-19 20:49:03700}
701
[email protected]b5b79d72012-05-24 19:42:28702void CreateCloudPrintSigninDialog(content::BrowserContext* browser_context,
703 gfx::NativeWindow modal_parent,
704 const base::Closure& callback) {
[email protected]4cd49022012-01-19 20:37:37705 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
706
707 BrowserThread::PostTask(
708 BrowserThread::UI, FROM_HERE,
709 base::Bind(&internal_cloud_print_helpers::CreateDialogSigninImpl,
[email protected]a9723e12013-03-05 04:02:45710 browser_context, modal_parent, callback));
[email protected]4cd49022012-01-19 20:37:37711}
712
[email protected]b5b79d72012-05-24 19:42:28713void CreatePrintDialogForBytes(content::BrowserContext* browser_context,
714 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45715 const base::RefCountedMemory* data,
[email protected]d955fc92011-09-19 20:49:03716 const string16& print_job_title,
717 const string16& print_ticket,
[email protected]b5b79d72012-05-24 19:42:28718 const std::string& file_type) {
[email protected]a9723e12013-03-05 04:02:45719 internal_cloud_print_helpers::CreateDialogImpl(browser_context, modal_parent,
720 data, print_job_title,
721 print_ticket, file_type, false,
722 base::Closure());
[email protected]6085c70d2011-03-22 22:51:07723}
724
[email protected]65c9d89a2011-04-13 21:02:39725bool CreatePrintDialogFromCommandLine(const CommandLine& command_line) {
[email protected]87ab41e72012-01-04 18:45:11726 DCHECK(command_line.HasSwitch(switches::kCloudPrintFile));
[email protected]65c9d89a2011-04-13 21:02:39727 if (!command_line.GetSwitchValuePath(switches::kCloudPrintFile).empty()) {
[email protected]650b2d52013-02-10 03:41:45728 base::FilePath cloud_print_file;
[email protected]65c9d89a2011-04-13 21:02:39729 cloud_print_file =
730 command_line.GetSwitchValuePath(switches::kCloudPrintFile);
731 if (!cloud_print_file.empty()) {
732 string16 print_job_title;
[email protected]e8368e92011-08-20 04:05:56733 string16 print_job_print_ticket;
[email protected]65c9d89a2011-04-13 21:02:39734 if (command_line.HasSwitch(switches::kCloudPrintJobTitle)) {
[email protected]e8368e92011-08-20 04:05:56735 print_job_title =
736 internal_cloud_print_helpers::GetSwitchValueString16(
737 command_line, switches::kCloudPrintJobTitle);
738 }
739 if (command_line.HasSwitch(switches::kCloudPrintPrintTicket)) {
740 print_job_print_ticket =
741 internal_cloud_print_helpers::GetSwitchValueString16(
742 command_line, switches::kCloudPrintPrintTicket);
[email protected]65c9d89a2011-04-13 21:02:39743 }
744 std::string file_type = "application/pdf";
745 if (command_line.HasSwitch(switches::kCloudPrintFileType)) {
746 file_type = command_line.GetSwitchValueASCII(
747 switches::kCloudPrintFileType);
748 }
[email protected]e8368e92011-08-20 04:05:56749
[email protected]d955fc92011-09-19 20:49:03750 bool delete_on_close = CommandLine::ForCurrentProcess()->HasSwitch(
751 switches::kCloudPrintDeleteFile);
752
[email protected]b5b79d72012-05-24 19:42:28753 print_dialog_cloud::CreatePrintDialogForFile(
754 ProfileManager::GetDefaultProfile(),
755 NULL,
756 cloud_print_file,
757 print_job_title,
758 print_job_print_ticket,
759 file_type,
760 delete_on_close);
[email protected]65c9d89a2011-04-13 21:02:39761 return true;
762 }
763 }
764 return false;
765}
766
[email protected]228f0f02013-11-15 05:58:36767} // namespace print_dialog_cloud