blob: 2a44102e00a4396ca338300ebeb00b4220342b01 [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]09cff78782014-04-20 22:04:4818#include "chrome/browser/google/google_util.h"
[email protected]2e6389f2012-05-18 19:41:2519#include "chrome/browser/lifetime/application_lifetime.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]6c465292014-01-14 15:38:3122#include "chrome/browser/ui/browser.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]09cff78782014-04-20 22:04:4828#include "components/cloud_devices/common/cloud_devices_urls.h"
[email protected]75fee372013-03-06 00:42:4429#include "components/user_prefs/pref_registry_syncable.h"
[email protected]c38831a12011-10-28 12:44:4930#include "content/public/browser/browser_thread.h"
[email protected]cdcb1dee2012-01-04 00:46:2031#include "content/public/browser/navigation_controller.h"
[email protected]022af742011-12-28 18:37:2532#include "content/public/browser/navigation_entry.h"
[email protected]6c2381d2011-10-19 02:52:5333#include "content/public/browser/notification_registrar.h"
34#include "content/public/browser/notification_source.h"
[email protected]0d6e9bd2011-10-18 04:29:1635#include "content/public/browser/notification_types.h"
[email protected]9c1662b2012-03-06 15:44:3336#include "content/public/browser/render_view_host.h"
[email protected]0ec4898e2011-12-30 21:09:2437#include "content/public/browser/web_contents.h"
[email protected]6c465292014-01-14 15:38:3138#include "content/public/browser/web_contents_observer.h"
[email protected]01ec4ec2012-01-18 04:13:4739#include "content/public/browser/web_ui.h"
[email protected]6c465292014-01-14 15:38:3140#include "content/public/common/frame_navigate_params.h"
[email protected]fab55e72013-05-31 07:06:1841#include "webkit/common/webpreferences.h"
[email protected]520c2022012-03-15 00:13:1542
[email protected]88bfd25b2012-06-22 06:28:3343#if defined(USE_AURA)
[email protected]88bfd25b2012-06-22 06:28:3344#include "ui/aura/window.h"
[email protected]7a60cd3a2014-03-20 20:54:5745#include "ui/aura/window_tree_host.h"
[email protected]88bfd25b2012-06-22 06:28:3346#endif
47
[email protected]520c2022012-03-15 00:13:1548#if defined(OS_WIN)
49#include "ui/base/win/foreground_helper.h"
50#endif
51
[email protected]73852b8f2010-05-14 00:38:1252// This module implements the UI support in Chrome for cloud printing.
53// This means hosting a dialog containing HTML/JavaScript and using
54// the published cloud print user interface integration APIs to get
55// page setup settings from the dialog contents and provide the
[email protected]a984bdf2011-03-15 20:17:1656// generated print data to the dialog contents for uploading to the
[email protected]73852b8f2010-05-14 00:38:1257// cloud print service.
58
59// Currently, the flow between these classes is as follows:
60
[email protected]a984bdf2011-03-15 20:17:1661// PrintDialogCloud::CreatePrintDialogForFile is called from
[email protected]73852b8f2010-05-14 00:38:1262// resource_message_filter_gtk.cc once the renderer has informed the
[email protected]a984bdf2011-03-15 20:17:1663// renderer host that print data generation into the renderer host provided
[email protected]032682b2011-01-12 22:05:0264// temp file has been completed. That call is on the FILE thread.
[email protected]73852b8f2010-05-14 00:38:1265// That, in turn, hops over to the UI thread to create an instance of
66// PrintDialogCloud.
67
68// The constructor for PrintDialogCloud creates a
[email protected]5835871a2012-04-25 21:56:5569// CloudPrintWebDialogDelegate and asks the current active browser to
[email protected]73852b8f2010-05-14 00:38:1270// show an HTML dialog using that class as the delegate. That class
[email protected]89f550b2011-06-08 18:34:0371// hands in the kChromeUICloudPrintResourcesURL as the URL to visit. That is
[email protected]80a8fad2011-01-29 04:02:3872// recognized by the GetWebUIFactoryFunction as a signal to create an
[email protected]02b5ccc2012-04-30 23:58:3173// ExternalWebDialogUI.
[email protected]73852b8f2010-05-14 00:38:1274
[email protected]5835871a2012-04-25 21:56:5575// CloudPrintWebDialogDelegate also temporarily owns a
[email protected]73852b8f2010-05-14 00:38:1276// CloudPrintFlowHandler, a class which is responsible for the actual
[email protected]a984bdf2011-03-15 20:17:1677// interactions with the dialog contents, including handing in the
[email protected]73852b8f2010-05-14 00:38:1278// print data and getting any page setup parameters that the dialog
79// contents provides. As part of bringing up the dialog,
[email protected]02b5ccc2012-04-30 23:58:3180// WebDialogUI::RenderViewCreated is called (an override of
[email protected]c39f9bf2011-02-12 00:43:5581// WebUI::RenderViewCreated). That routine, in turn, calls the
[email protected]36e12172011-02-08 23:46:0282// delegate's GetWebUIMessageHandlers routine, at which point the
[email protected]73852b8f2010-05-14 00:38:1283// ownership of the CloudPrintFlowHandler is handed over. A pointer
84// to the flow handler is kept to facilitate communication back and
85// forth between the two classes.
86
[email protected]c39f9bf2011-02-12 00:43:5587// The WebUI continues dialog bring-up, calling
[email protected]73852b8f2010-05-14 00:38:1288// CloudPrintFlowHandler::RegisterMessages. This is where the
89// additional object model capabilities are registered for the dialog
90// contents to use. It is also at this time that capabilities for the
91// dialog contents are adjusted to allow the dialog contents to close
92// the window. In addition, the pending URL is redirected to the
93// actual cloud print service URL. The flow controller also registers
94// for notification of when the dialog contents finish loading, which
[email protected]a984bdf2011-03-15 20:17:1695// is currently used to send the data to the dialog contents.
[email protected]73852b8f2010-05-14 00:38:1296
[email protected]a984bdf2011-03-15 20:17:1697// In order to send the data to the dialog contents, the flow
[email protected]73852b8f2010-05-14 00:38:1298// handler uses a CloudPrintDataSender. It creates one, letting it
[email protected]a984bdf2011-03-15 20:17:1699// know the name of the temporary file containing the data, and
[email protected]73852b8f2010-05-14 00:38:12100// posts the task of reading the file
101// (CloudPrintDataSender::ReadPrintDataFile) to the file thread. That
102// routine reads in the file, and then hops over to the IO thread to
103// send that data to the dialog contents.
104
105// When the dialog contents are finished (by either being cancelled or
106// hitting the print button), the delegate is notified, and responds
107// that the dialog should be closed, at which point things are torn
108// down and released.
109
[email protected]631bb742011-11-02 11:29:39110using content::BrowserThread;
[email protected]c5eed492012-01-04 17:07:50111using content::NavigationController;
[email protected]10f417c52011-12-28 21:04:23112using content::NavigationEntry;
[email protected]eaabba22012-03-07 15:02:11113using content::RenderViewHost;
[email protected]a81343d232011-12-27 07:39:20114using content::WebContents;
[email protected]26e2632a2011-12-31 04:02:55115using content::WebUIMessageHandler;
[email protected]20c07f8e2012-05-31 08:43:14116using ui::WebDialogDelegate;
[email protected]631bb742011-11-02 11:29:39117
[email protected]6c465292014-01-14 15:38:31118namespace {
119
[email protected]681958c2013-02-21 13:48:14120const int kDefaultWidth = 912;
121const int kDefaultHeight = 633;
122
[email protected]6c465292014-01-14 15:38:31123bool IsSimilarUrl(const GURL& url, const GURL& cloud_print_url) {
124 return url.host() == cloud_print_url.host() &&
125 StartsWithASCII(url.path(), cloud_print_url.path(), false) &&
126 url.scheme() == cloud_print_url.scheme();
127}
128
129class SignInObserver : public content::WebContentsObserver {
130 public:
131 SignInObserver(content::WebContents* web_contents,
132 GURL cloud_print_url,
133 const base::Closure& callback)
134 : WebContentsObserver(web_contents),
135 cloud_print_url_(cloud_print_url),
136 callback_(callback),
137 weak_ptr_factory_(this) {
138 }
139
140 private:
141 // Overridden from content::WebContentsObserver:
142 virtual void DidNavigateMainFrame(
143 const content::LoadCommittedDetails& details,
144 const content::FrameNavigateParams& params) OVERRIDE {
145 if (IsSimilarUrl(params.url, cloud_print_url_)) {
146 base::MessageLoop::current()->PostTask(
147 FROM_HERE,
148 base::Bind(&SignInObserver::OnSignIn,
149 weak_ptr_factory_.GetWeakPtr()));
150 }
151 }
152
153 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE {
154 delete this;
155 }
156
157 void OnSignIn() {
158 callback_.Run();
159 if (web_contents())
160 web_contents()->Close();
161 }
162
163 GURL cloud_print_url_;
164 base::Closure callback_;
165 base::WeakPtrFactory<SignInObserver> weak_ptr_factory_;
166
167 DISALLOW_COPY_AND_ASSIGN(SignInObserver);
168};
169
170} // namespace
171
[email protected]73852b8f2010-05-14 00:38:12172namespace internal_cloud_print_helpers {
173
[email protected]73852b8f2010-05-14 00:38:12174// From the JSON parsed value, get the entries for the page setup
175// parameters.
176bool GetPageSetupParameters(const std::string& json,
[email protected]1375e3ab2011-03-24 17:07:22177 PrintMsg_Print_Params& parameters) {
[email protected]dbb9aa42013-12-23 20:08:21178 scoped_ptr<base::Value> parsed_value(base::JSONReader::Read(json));
[email protected]73852b8f2010-05-14 00:38:12179 DLOG_IF(ERROR, (!parsed_value.get() ||
[email protected]dbb9aa42013-12-23 20:08:21180 !parsed_value->IsType(base::Value::TYPE_DICTIONARY)))
[email protected]73852b8f2010-05-14 00:38:12181 << "PageSetup call didn't have expected contents";
[email protected]dbb9aa42013-12-23 20:08:21182 if (!parsed_value.get() ||
183 !parsed_value->IsType(base::Value::TYPE_DICTIONARY)) {
[email protected]73852b8f2010-05-14 00:38:12184 return false;
[email protected]dbb9aa42013-12-23 20:08:21185 }
[email protected]73852b8f2010-05-14 00:38:12186
187 bool result = true;
[email protected]dbb9aa42013-12-23 20:08:21188 base::DictionaryValue* params =
189 static_cast<base::DictionaryValue*>(parsed_value.get());
[email protected]05c7da62011-05-05 17:23:56190 result &= params->GetDouble("dpi", &parameters.dpi);
191 result &= params->GetDouble("min_shrink", &parameters.min_shrink);
192 result &= params->GetDouble("max_shrink", &parameters.max_shrink);
[email protected]a65175d2010-08-17 04:00:57193 result &= params->GetBoolean("selection_only", &parameters.selection_only);
[email protected]73852b8f2010-05-14 00:38:12194 return result;
195}
196
[email protected]536f86a2013-11-23 01:24:56197base::string16 GetSwitchValueString16(const CommandLine& command_line,
198 const char* switchName) {
[email protected]31662202013-03-23 19:10:54199#if defined(OS_WIN)
[email protected]536f86a2013-11-23 01:24:56200 return command_line.GetSwitchValueNative(switchName);
[email protected]e8368e92011-08-20 04:05:56201#elif defined(OS_POSIX)
202 // POSIX Command line string types are different.
203 CommandLine::StringType native_switch_val;
204 native_switch_val = command_line.GetSwitchValueASCII(switchName);
205 // Convert the ASCII string to UTF16 to prepare to pass.
[email protected]536f86a2013-11-23 01:24:56206 return base::ASCIIToUTF16(native_switch_val);
[email protected]e8368e92011-08-20 04:05:56207#endif
208}
209
[email protected]73852b8f2010-05-14 00:38:12210void CloudPrintDataSenderHelper::CallJavascriptFunction(
[email protected]dbb9aa42013-12-23 20:08:21211 const std::string& function_name,
212 const base::Value& arg1,
213 const base::Value& arg2) {
[email protected]536f86a2013-11-23 01:24:56214 web_ui_->CallJavascriptFunction(function_name, arg1, arg2);
[email protected]e8368e92011-08-20 04:05:56215}
216
[email protected]73852b8f2010-05-14 00:38:12217// Clears out the pointer we're using to communicate. Either routine is
218// potentially expensive enough that stopping whatever is in progress
219// is worth it.
220void CloudPrintDataSender::CancelPrintDataFile() {
[email protected]20305ec2011-01-21 04:55:52221 base::AutoLock lock(lock_);
[email protected]73852b8f2010-05-14 00:38:12222 // We don't own helper, it was passed in to us, so no need to
223 // delete, just let it go.
224 helper_ = NULL;
225}
226
[email protected]0085863a2013-12-06 21:19:03227CloudPrintDataSender::CloudPrintDataSender(
228 CloudPrintDataSenderHelper* helper,
229 const base::string16& print_job_title,
230 const base::string16& print_ticket,
231 const std::string& file_type,
232 const base::RefCountedMemory* data)
[email protected]38e08982010-10-22 17:28:43233 : helper_(helper),
[email protected]a984bdf2011-03-15 20:17:16234 print_job_title_(print_job_title),
[email protected]e8368e92011-08-20 04:05:56235 print_ticket_(print_ticket),
[email protected]a9723e12013-03-05 04:02:45236 file_type_(file_type),
237 data_(data) {
[email protected]38e08982010-10-22 17:28:43238}
239
240CloudPrintDataSender::~CloudPrintDataSender() {}
241
[email protected]73852b8f2010-05-14 00:38:12242// We have the data in hand that needs to be pushed into the dialog
243// contents; do so from the IO thread.
244
245// TODO(scottbyer): If the print data ends up being larger than the
246// upload limit (currently 10MB), what we need to do is upload that
247// large data to google docs and set the URL in the printing
248// JavaScript to that location, and make sure it gets deleted when not
249// needed. - 4/1/2010
[email protected]a9723e12013-03-05 04:02:45250void CloudPrintDataSender::SendPrintData() {
[email protected]dee01572014-04-18 22:33:44251 DCHECK_CURRENTLY_ON(BrowserThread::IO);
[email protected]5173de8b2013-06-02 21:16:02252 if (!data_.get() || !data_->size())
[email protected]a9723e12013-03-05 04:02:45253 return;
254
255 std::string base64_data;
256 base::Base64Encode(
[email protected]8df08cf2014-02-12 22:34:08257 base::StringPiece(data_->front_as<char>(), data_->size()),
[email protected]a9723e12013-03-05 04:02:45258 &base64_data);
[email protected]a9723e12013-03-05 04:02:45259 std::string header("data:");
260 header.append(file_type_);
261 header.append(";base64,");
262 base64_data.insert(0, header);
263
[email protected]20305ec2011-01-21 04:55:52264 base::AutoLock lock(lock_);
[email protected]a9723e12013-03-05 04:02:45265 if (helper_) {
[email protected]536f86a2013-11-23 01:24:56266 base::StringValue title(print_job_title_);
267 base::StringValue ticket(print_ticket_);
[email protected]e8368e92011-08-20 04:05:56268 // TODO(abodenha): Change Javascript call to pass in print ticket
269 // after server side support is added. Add test for it.
[email protected]73852b8f2010-05-14 00:38:12270
271 // Send the print data to the dialog contents. The JavaScript
272 // function is a preliminary API for prototyping purposes and is
273 // subject to change.
[email protected]536f86a2013-11-23 01:24:56274 helper_->CallJavascriptFunction(
275 "printApp._printDataUrl", base::StringValue(base64_data), title);
[email protected]73852b8f2010-05-14 00:38:12276 }
277}
278
279
[email protected]0085863a2013-12-06 21:19:03280CloudPrintFlowHandler::CloudPrintFlowHandler(
281 const base::RefCountedMemory* data,
282 const base::string16& print_job_title,
283 const base::string16& print_ticket,
[email protected]6c465292014-01-14 15:38:31284 const std::string& file_type)
[email protected]c7bf7452011-09-12 21:31:50285 : dialog_delegate_(NULL),
[email protected]a9723e12013-03-05 04:02:45286 data_(data),
[email protected]a984bdf2011-03-15 20:17:16287 print_job_title_(print_job_title),
[email protected]e8368e92011-08-20 04:05:56288 print_ticket_(print_ticket),
[email protected]6c465292014-01-14 15:38:31289 file_type_(file_type) {
[email protected]38e08982010-10-22 17:28:43290}
291
292CloudPrintFlowHandler::~CloudPrintFlowHandler() {
293 // This will also cancel any task in flight.
294 CancelAnyRunningTask();
295}
296
297
[email protected]73852b8f2010-05-14 00:38:12298void CloudPrintFlowHandler::SetDialogDelegate(
[email protected]5835871a2012-04-25 21:56:55299 CloudPrintWebDialogDelegate* delegate) {
[email protected]7b748982011-02-14 19:28:23300 // Even if setting a new WebUI, it means any previous task needs
[email protected]a2c92a1c2012-04-03 12:32:14301 // to be canceled, its now invalid.
[email protected]dee01572014-04-18 22:33:44302 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]73852b8f2010-05-14 00:38:12303 CancelAnyRunningTask();
304 dialog_delegate_ = delegate;
305}
306
307// Cancels any print data sender we have in flight and removes our
308// reference to it, so when the task that is calling it finishes and
[email protected]a2c92a1c2012-04-03 12:32:14309// removes its reference, it goes away.
[email protected]73852b8f2010-05-14 00:38:12310void CloudPrintFlowHandler::CancelAnyRunningTask() {
[email protected]dee01572014-04-18 22:33:44311 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]73852b8f2010-05-14 00:38:12312 if (print_data_sender_.get()) {
313 print_data_sender_->CancelPrintDataFile();
314 print_data_sender_ = NULL;
315 }
316}
317
[email protected]73852b8f2010-05-14 00:38:12318void CloudPrintFlowHandler::RegisterMessages() {
[email protected]73852b8f2010-05-14 00:38:12319 // TODO(scottbyer) - This is where we will register messages for the
320 // UI JS to use. Needed: Call to update page setup parameters.
[email protected]46adf7ff2011-12-30 00:53:09321 web_ui()->RegisterMessageCallback("ShowDebugger",
[email protected]ba4fc242011-10-04 18:56:56322 base::Bind(&CloudPrintFlowHandler::HandleShowDebugger,
323 base::Unretained(this)));
[email protected]46adf7ff2011-12-30 00:53:09324 web_ui()->RegisterMessageCallback("SendPrintData",
[email protected]ba4fc242011-10-04 18:56:56325 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData,
326 base::Unretained(this)));
[email protected]46adf7ff2011-12-30 00:53:09327 web_ui()->RegisterMessageCallback("SetPageParameters",
[email protected]ba4fc242011-10-04 18:56:56328 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters,
329 base::Unretained(this)));
[email protected]73852b8f2010-05-14 00:38:12330
[email protected]0eb25c42011-08-11 14:50:14331 // Register for appropriate notifications, and re-direct the URL
332 // to the real server URL, now that we've gotten an HTML dialog
333 // going.
[email protected]c5eed492012-01-04 17:07:50334 NavigationController* controller =
[email protected]01ec4ec2012-01-18 04:13:47335 &web_ui()->GetWebContents()->GetController();
[email protected]10f417c52011-12-28 21:04:23336 NavigationEntry* pending_entry = controller->GetPendingEntry();
[email protected]0eb25c42011-08-11 14:50:14337 if (pending_entry) {
[email protected]09cff78782014-04-20 22:04:48338 pending_entry->SetURL(google_util::AppendGoogleLocaleParam(
339 cloud_devices::GetCloudPrintRelativeURL("client/dialog.html")));
[email protected]73852b8f2010-05-14 00:38:12340 }
[email protected]0eb25c42011-08-11 14:50:14341 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
[email protected]c5eed492012-01-04 17:07:50342 content::Source<NavigationController>(controller));
[email protected]57c8cf22013-03-02 16:50:00343 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
344 content::Source<NavigationController>(controller));
[email protected]73852b8f2010-05-14 00:38:12345}
346
[email protected]6c2381d2011-10-19 02:52:53347void CloudPrintFlowHandler::Observe(
348 int type,
349 const content::NotificationSource& source,
350 const content::NotificationDetails& details) {
[email protected]57c8cf22013-03-02 16:50:00351 switch (type) {
[email protected]57c8cf22013-03-02 16:50:00352 case content::NOTIFICATION_LOAD_STOP: {
[email protected]57c8cf22013-03-02 16:50:00353 GURL url = web_ui()->GetWebContents()->GetURL();
[email protected]6e536cdf2013-05-09 04:49:52354 if (IsCloudPrintDialogUrl(url)) {
355 // Take the opportunity to set some (minimal) additional
356 // script permissions required for the web UI.
[email protected]57c8cf22013-03-02 16:50:00357 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost();
358 if (rvh) {
[email protected]3184f90b2013-05-01 18:17:53359 WebPreferences webkit_prefs = rvh->GetWebkitPreferences();
[email protected]57c8cf22013-03-02 16:50:00360 webkit_prefs.allow_scripts_to_close_windows = true;
361 rvh->UpdateWebkitPreferences(webkit_prefs);
362 } else {
363 NOTREACHED();
364 }
[email protected]6e536cdf2013-05-09 04:49:52365 // Choose one or the other. If you need to debug, bring up the
366 // debugger. You can then use the various chrome.send()
367 // registrations above to kick of the various function calls,
368 // including chrome.send("SendPrintData") in the javaScript
369 // console and watch things happen with:
370 // HandleShowDebugger(NULL);
371 HandleSendPrintData(NULL);
[email protected]57c8cf22013-03-02 16:50:00372 }
[email protected]57c8cf22013-03-02 16:50:00373 break;
374 }
[email protected]73852b8f2010-05-14 00:38:12375 }
376}
377
[email protected]dbb9aa42013-12-23 20:08:21378void CloudPrintFlowHandler::HandleShowDebugger(const base::ListValue* args) {
[email protected]73852b8f2010-05-14 00:38:12379 ShowDebugger();
380}
381
382void CloudPrintFlowHandler::ShowDebugger() {
[email protected]46adf7ff2011-12-30 00:53:09383 if (web_ui()) {
[email protected]01ec4ec2012-01-18 04:13:47384 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost();
[email protected]73852b8f2010-05-14 00:38:12385 if (rvh)
[email protected]aebdd072011-07-07 12:36:59386 DevToolsWindow::OpenDevToolsWindow(rvh);
[email protected]73852b8f2010-05-14 00:38:12387 }
388}
389
390scoped_refptr<CloudPrintDataSender>
391CloudPrintFlowHandler::CreateCloudPrintDataSender() {
[email protected]46adf7ff2011-12-30 00:53:09392 DCHECK(web_ui());
393 print_data_helper_.reset(new CloudPrintDataSenderHelper(web_ui()));
[email protected]a9723e12013-03-05 04:02:45394 scoped_refptr<CloudPrintDataSender> sender(
[email protected]5173de8b2013-06-02 21:16:02395 new CloudPrintDataSender(print_data_helper_.get(),
396 print_job_title_,
397 print_ticket_,
398 file_type_,
399 data_.get()));
[email protected]a9723e12013-03-05 04:02:45400 return sender;
[email protected]73852b8f2010-05-14 00:38:12401}
402
[email protected]dbb9aa42013-12-23 20:08:21403void CloudPrintFlowHandler::HandleSendPrintData(const base::ListValue* args) {
[email protected]dee01572014-04-18 22:33:44404 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]73852b8f2010-05-14 00:38:12405 // This will cancel any ReadPrintDataFile() or SendPrintDataFile()
406 // requests in flight (this is anticipation of when setting page
407 // setup parameters becomes asynchronous and may be set while some
408 // data is in flight). Then we can clear out the print data.
409 CancelAnyRunningTask();
[email protected]46adf7ff2011-12-30 00:53:09410 if (web_ui()) {
[email protected]73852b8f2010-05-14 00:38:12411 print_data_sender_ = CreateCloudPrintDataSender();
[email protected]3e2dd4fa2011-11-10 06:06:40412 BrowserThread::PostTask(
[email protected]a9723e12013-03-05 04:02:45413 BrowserThread::IO, FROM_HERE,
414 base::Bind(&CloudPrintDataSender::SendPrintData, print_data_sender_));
[email protected]73852b8f2010-05-14 00:38:12415 }
416}
417
[email protected]dbb9aa42013-12-23 20:08:21418void CloudPrintFlowHandler::HandleSetPageParameters(
419 const base::ListValue* args) {
[email protected]036056a32011-03-03 21:05:01420 std::string json;
[email protected]e675f7b2011-06-22 17:32:12421 bool ret = args->GetString(0, &json);
422 if (!ret || json.empty()) {
[email protected]036056a32011-03-03 21:05:01423 NOTREACHED() << "Empty json string";
[email protected]73852b8f2010-05-14 00:38:12424 return;
[email protected]036056a32011-03-03 21:05:01425 }
[email protected]73852b8f2010-05-14 00:38:12426
427 // These are backstop default values - 72 dpi to match the screen,
428 // 8.5x11 inch paper with margins subtracted (1/4 inch top, left,
429 // right and 0.56 bottom), and the min page shrink and max page
430 // shrink values appear all over the place with no explanation.
431
432 // TODO(scottbyer): Get a Linux/ChromeOS edge for PrintSettings
433 // working so that we can get the default values from there. Fix up
434 // PrintWebViewHelper to do the same.
435 const int kDPI = 72;
436 const int kWidth = static_cast<int>((8.5-0.25-0.25)*kDPI);
437 const int kHeight = static_cast<int>((11-0.25-0.56)*kDPI);
438 const double kMinPageShrink = 1.25;
439 const double kMaxPageShrink = 2.0;
440
[email protected]1375e3ab2011-03-24 17:07:22441 PrintMsg_Print_Params default_settings;
[email protected]10980442011-12-04 22:33:05442 default_settings.content_size = gfx::Size(kWidth, kHeight);
[email protected]732b8132012-01-10 23:17:32443 default_settings.printable_area = gfx::Rect(0, 0, kWidth, kHeight);
[email protected]73852b8f2010-05-14 00:38:12444 default_settings.dpi = kDPI;
445 default_settings.min_shrink = kMinPageShrink;
446 default_settings.max_shrink = kMaxPageShrink;
447 default_settings.desired_dpi = kDPI;
448 default_settings.document_cookie = 0;
449 default_settings.selection_only = false;
[email protected]718af822011-08-12 22:11:33450 default_settings.preview_request_id = 0;
451 default_settings.is_first_request = true;
[email protected]732b8132012-01-10 23:17:32452 default_settings.print_to_pdf = false;
[email protected]73852b8f2010-05-14 00:38:12453
454 if (!GetPageSetupParameters(json, default_settings)) {
455 NOTREACHED();
456 return;
457 }
458
459 // TODO(scottbyer) - Here is where we would kick the originating
460 // renderer thread with these new parameters in order to get it to
[email protected]a984bdf2011-03-15 20:17:16461 // re-generate the PDF data and hand it back to us. window.print() is
[email protected]73852b8f2010-05-14 00:38:12462 // currently synchronous, so there's a lot of work to do to get to
463 // that point.
464}
465
[email protected]ea161da2010-11-02 21:57:35466void CloudPrintFlowHandler::StoreDialogClientSize() const {
[email protected]fc2b46b2014-05-03 16:33:45467 if (web_ui() && web_ui()->GetWebContents()) {
468 gfx::Size size = web_ui()->GetWebContents()->GetContainerBounds().size();
[email protected]46adf7ff2011-12-30 00:53:09469 Profile* profile = Profile::FromWebUI(web_ui());
[email protected]0eb25c42011-08-11 14:50:14470 profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogWidth,
471 size.width());
472 profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogHeight,
473 size.height());
[email protected]ea161da2010-11-02 21:57:35474 }
475}
476
[email protected]6e536cdf2013-05-09 04:49:52477bool CloudPrintFlowHandler::IsCloudPrintDialogUrl(const GURL& url) {
[email protected]09cff78782014-04-20 22:04:48478 GURL cloud_print_url = cloud_devices::GetCloudPrintURL();
[email protected]6c465292014-01-14 15:38:31479 return IsSimilarUrl(url, cloud_print_url);
[email protected]6e536cdf2013-05-09 04:49:52480}
481
[email protected]5835871a2012-04-25 21:56:55482CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate(
[email protected]b5b79d72012-05-24 19:42:28483 content::BrowserContext* browser_context,
484 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45485 const base::RefCountedMemory* data,
[email protected]9848c7e2010-06-03 16:06:56486 const std::string& json_arguments,
[email protected]0085863a2013-12-06 21:19:03487 const base::string16& print_job_title,
488 const base::string16& print_ticket,
[email protected]6c465292014-01-14 15:38:31489 const std::string& file_type)
[email protected]a9723e12013-03-05 04:02:45490 : flow_handler_(
491 new CloudPrintFlowHandler(data, print_job_title, print_ticket,
[email protected]6c465292014-01-14 15:38:31492 file_type)),
[email protected]b5b79d72012-05-24 19:42:28493 modal_parent_(modal_parent),
[email protected]6ddda232011-04-22 15:41:47494 owns_flow_handler_(true),
[email protected]b5b79d72012-05-24 19:42:28495 keep_alive_when_non_modal_(true) {
496 Init(browser_context, json_arguments);
[email protected]73852b8f2010-05-14 00:38:12497}
498
[email protected]05acb55472011-02-03 00:11:07499// For unit testing.
[email protected]5835871a2012-04-25 21:56:55500CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate(
[email protected]73852b8f2010-05-14 00:38:12501 CloudPrintFlowHandler* flow_handler,
[email protected]a9723e12013-03-05 04:02:45502 const std::string& json_arguments)
503 : flow_handler_(flow_handler),
[email protected]b5b79d72012-05-24 19:42:28504 modal_parent_(NULL),
505 owns_flow_handler_(true),
506 keep_alive_when_non_modal_(false) {
507 Init(NULL, json_arguments);
[email protected]73852b8f2010-05-14 00:38:12508}
509
[email protected]b5b79d72012-05-24 19:42:28510// Returns the persisted width/height for the print dialog.
511void GetDialogWidthAndHeightFromPrefs(content::BrowserContext* browser_context,
512 int* width,
513 int* height) {
[email protected]b5b79d72012-05-24 19:42:28514 if (!browser_context) {
515 *width = kDefaultWidth;
516 *height = kDefaultHeight;
517 return;
518 }
519
[email protected]c753f142013-02-10 13:14:04520 PrefService* prefs = Profile::FromBrowserContext(browser_context)->GetPrefs();
[email protected]c753f142013-02-10 13:14:04521 *width = prefs->GetInteger(prefs::kCloudPrintDialogWidth);
522 *height = prefs->GetInteger(prefs::kCloudPrintDialogHeight);
[email protected]b5b79d72012-05-24 19:42:28523}
524
525void CloudPrintWebDialogDelegate::Init(content::BrowserContext* browser_context,
[email protected]5835871a2012-04-25 21:56:55526 const std::string& json_arguments) {
[email protected]73852b8f2010-05-14 00:38:12527 // This information is needed to show the dialog HTML content.
[email protected]dee01572014-04-18 22:33:44528 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]b5b79d72012-05-24 19:42:28529
[email protected]89f550b2011-06-08 18:34:03530 params_.url = GURL(chrome::kChromeUICloudPrintResourcesURL);
[email protected]b5b79d72012-05-24 19:42:28531 GetDialogWidthAndHeightFromPrefs(browser_context,
532 &params_.width,
533 &params_.height);
[email protected]73852b8f2010-05-14 00:38:12534 params_.json_input = json_arguments;
535
536 flow_handler_->SetDialogDelegate(this);
[email protected]e39027a2011-01-24 21:41:54537 // If we're not modal we can show the dialog with no browser.
538 // We need this to keep Chrome alive while our dialog is up.
[email protected]b5b79d72012-05-24 19:42:28539 if (!modal_parent_ && keep_alive_when_non_modal_)
[email protected]9a718b22014-02-25 15:17:27540 chrome::IncrementKeepAliveCount();
[email protected]73852b8f2010-05-14 00:38:12541}
542
[email protected]5835871a2012-04-25 21:56:55543CloudPrintWebDialogDelegate::~CloudPrintWebDialogDelegate() {
[email protected]73852b8f2010-05-14 00:38:12544 // If the flow_handler_ is about to outlive us because we don't own
[email protected]a2c92a1c2012-04-03 12:32:14545 // it anymore, we need to have it remove its reference to us.
[email protected]dee01572014-04-18 22:33:44546 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]73852b8f2010-05-14 00:38:12547 flow_handler_->SetDialogDelegate(NULL);
548 if (owns_flow_handler_) {
549 delete flow_handler_;
550 }
551}
552
[email protected]5835871a2012-04-25 21:56:55553ui::ModalType CloudPrintWebDialogDelegate::GetDialogModalType() const {
[email protected]b5b79d72012-05-24 19:42:28554 return modal_parent_ ? ui::MODAL_TYPE_WINDOW : ui::MODAL_TYPE_NONE;
[email protected]73852b8f2010-05-14 00:38:12555}
556
[email protected]6a72a632013-12-12 22:22:00557base::string16 CloudPrintWebDialogDelegate::GetDialogTitle() const {
[email protected]0085863a2013-12-06 21:19:03558 return base::string16();
[email protected]73852b8f2010-05-14 00:38:12559}
560
[email protected]5835871a2012-04-25 21:56:55561GURL CloudPrintWebDialogDelegate::GetDialogContentURL() const {
[email protected]73852b8f2010-05-14 00:38:12562 return params_.url;
563}
564
[email protected]5835871a2012-04-25 21:56:55565void CloudPrintWebDialogDelegate::GetWebUIMessageHandlers(
[email protected]36e12172011-02-08 23:46:02566 std::vector<WebUIMessageHandler*>* handlers) const {
[email protected]73852b8f2010-05-14 00:38:12567 handlers->push_back(flow_handler_);
568 // We don't own flow_handler_ anymore, but it sticks around until at
569 // least right after OnDialogClosed() is called (and this object is
570 // destroyed).
571 owns_flow_handler_ = false;
572}
573
[email protected]5835871a2012-04-25 21:56:55574void CloudPrintWebDialogDelegate::GetDialogSize(gfx::Size* size) const {
[email protected]73852b8f2010-05-14 00:38:12575 size->set_width(params_.width);
576 size->set_height(params_.height);
577}
578
[email protected]5835871a2012-04-25 21:56:55579std::string CloudPrintWebDialogDelegate::GetDialogArgs() const {
[email protected]73852b8f2010-05-14 00:38:12580 return params_.json_input;
581}
582
[email protected]5835871a2012-04-25 21:56:55583void CloudPrintWebDialogDelegate::OnDialogClosed(
[email protected]73852b8f2010-05-14 00:38:12584 const std::string& json_retval) {
[email protected]ea161da2010-11-02 21:57:35585 // Get the final dialog size and store it.
586 flow_handler_->StoreDialogClientSize();
[email protected]6ddda232011-04-22 15:41:47587
[email protected]e39027a2011-01-24 21:41:54588 // If we're modal we can show the dialog with no browser.
589 // End the keep-alive so that Chrome can exit.
[email protected]129bedf2013-11-20 07:34:03590 if (!modal_parent_ && keep_alive_when_non_modal_) {
591 // Post to prevent recursive call tho this function.
[email protected]9a718b22014-02-25 15:17:27592 base::MessageLoop::current()->PostTask(
593 FROM_HERE, base::Bind(&chrome::DecrementKeepAliveCount));
[email protected]129bedf2013-11-20 07:34:03594 }
[email protected]73852b8f2010-05-14 00:38:12595 delete this;
596}
597
[email protected]5835871a2012-04-25 21:56:55598void CloudPrintWebDialogDelegate::OnCloseContents(WebContents* source,
599 bool* out_close_dialog) {
[email protected]18137e02010-05-25 21:10:35600 if (out_close_dialog)
601 *out_close_dialog = true;
602}
603
[email protected]5835871a2012-04-25 21:56:55604bool CloudPrintWebDialogDelegate::ShouldShowDialogTitle() const {
[email protected]ea161da2010-11-02 21:57:35605 return false;
606}
607
[email protected]5835871a2012-04-25 21:56:55608bool CloudPrintWebDialogDelegate::HandleContextMenu(
[email protected]35be7ec2012-02-12 20:42:51609 const content::ContextMenuParams& params) {
[email protected]34478212011-04-19 01:35:46610 return true;
611}
612
[email protected]6085c70d2011-03-22 22:51:07613// Called from the UI thread, starts up the dialog.
[email protected]b5b79d72012-05-24 19:42:28614void CreateDialogImpl(content::BrowserContext* browser_context,
615 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45616 const base::RefCountedMemory* data,
[email protected]0085863a2013-12-06 21:19:03617 const base::string16& print_job_title,
618 const base::string16& print_ticket,
[email protected]6c465292014-01-14 15:38:31619 const std::string& file_type) {
[email protected]dee01572014-04-18 22:33:44620 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]5835871a2012-04-25 21:56:55621 WebDialogDelegate* dialog_delegate =
622 new internal_cloud_print_helpers::CloudPrintWebDialogDelegate(
[email protected]a9723e12013-03-05 04:02:45623 browser_context, modal_parent, data, std::string(), print_job_title,
[email protected]6c465292014-01-14 15:38:31624 print_ticket, file_type);
[email protected]88bfd25b2012-06-22 06:28:33625#if defined(OS_WIN)
626 gfx::NativeWindow window =
627#endif
[email protected]87586fb72012-07-02 13:15:02628 chrome::ShowWebDialog(modal_parent,
629 Profile::FromBrowserContext(browser_context),
630 dialog_delegate);
[email protected]88bfd25b2012-06-22 06:28:33631#if defined(OS_WIN)
[email protected]a9723e12013-03-05 04:02:45632 if (window) {
[email protected]88bfd25b2012-06-22 06:28:33633 HWND dialog_handle;
634#if defined(USE_AURA)
[email protected]2374d1812014-03-04 03:42:27635 dialog_handle = window->GetHost()->GetAcceleratedWidget();
[email protected]88bfd25b2012-06-22 06:28:33636#else
637 dialog_handle = window;
638#endif
639 if (::GetForegroundWindow() != dialog_handle) {
640 ui::ForegroundHelper::SetForeground(dialog_handle);
641 }
642 }
643#endif
[email protected]73852b8f2010-05-14 00:38:12644}
[email protected]6085c70d2011-03-22 22:51:07645
[email protected]a9723e12013-03-05 04:02:45646void CreateDialogForFileImpl(content::BrowserContext* browser_context,
647 gfx::NativeWindow modal_parent,
648 const base::FilePath& path_to_file,
[email protected]0085863a2013-12-06 21:19:03649 const base::string16& print_job_title,
650 const base::string16& print_ticket,
[email protected]c9060842014-03-13 01:26:19651 const std::string& file_type) {
[email protected]dee01572014-04-18 22:33:44652 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
[email protected]a9723e12013-03-05 04:02:45653 scoped_refptr<base::RefCountedMemory> data;
654 int64 file_size = 0;
[email protected]56285702013-12-04 18:22:49655 if (base::GetFileSize(path_to_file, &file_size) && file_size != 0) {
[email protected]a9723e12013-03-05 04:02:45656 std::string file_data;
657 if (file_size < kuint32max) {
658 file_data.reserve(static_cast<unsigned int>(file_size));
659 } else {
660 DLOG(WARNING) << " print data file too large to reserve space";
661 }
[email protected]82f84b92013-08-30 18:23:50662 if (base::ReadFileToString(path_to_file, &file_data)) {
[email protected]a9723e12013-03-05 04:02:45663 data = base::RefCountedString::TakeString(&file_data);
664 }
665 }
666 // Proceed even for empty data to simplify testing.
667 BrowserThread::PostTask(
668 BrowserThread::UI, FROM_HERE,
669 base::Bind(&print_dialog_cloud::CreatePrintDialogForBytes,
670 browser_context, modal_parent, data, print_job_title,
671 print_ticket, file_type));
[email protected]c9060842014-03-13 01:26:19672 base::DeleteFile(path_to_file, false);
[email protected]6ddda232011-04-22 15:41:47673}
674
[email protected]6085c70d2011-03-22 22:51:07675} // namespace internal_cloud_print_helpers
676
677namespace print_dialog_cloud {
678
[email protected]37ca3fe02013-07-05 15:32:44679void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
[email protected]681958c2013-02-21 13:48:14680 registry->RegisterIntegerPref(
681 prefs::kCloudPrintDialogWidth,
682 kDefaultWidth,
[email protected]443e9312013-05-06 06:17:34683 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]681958c2013-02-21 13:48:14684 registry->RegisterIntegerPref(
685 prefs::kCloudPrintDialogHeight,
686 kDefaultHeight,
[email protected]443e9312013-05-06 06:17:34687 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]681958c2013-02-21 13:48:14688}
689
[email protected]6085c70d2011-03-22 22:51:07690// Called on the FILE or UI thread. This is the main entry point into creating
691// the dialog.
692
[email protected]b5b79d72012-05-24 19:42:28693void CreatePrintDialogForFile(content::BrowserContext* browser_context,
694 gfx::NativeWindow modal_parent,
[email protected]650b2d52013-02-10 03:41:45695 const base::FilePath& path_to_file,
[email protected]0085863a2013-12-06 21:19:03696 const base::string16& print_job_title,
697 const base::string16& print_ticket,
[email protected]c9060842014-03-13 01:26:19698 const std::string& file_type) {
[email protected]6085c70d2011-03-22 22:51:07699 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE) ||
700 BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]6085c70d2011-03-22 22:51:07701 BrowserThread::PostTask(
[email protected]a9723e12013-03-05 04:02:45702 BrowserThread::FILE, FROM_HERE,
703 base::Bind(&internal_cloud_print_helpers::CreateDialogForFileImpl,
[email protected]b5b79d72012-05-24 19:42:28704 browser_context, modal_parent, path_to_file, print_job_title,
[email protected]c9060842014-03-13 01:26:19705 print_ticket, file_type));
[email protected]d955fc92011-09-19 20:49:03706}
707
[email protected]6c465292014-01-14 15:38:31708void CreateCloudPrintSigninTab(Browser* browser,
[email protected]7b92eea9e2014-04-01 09:17:11709 bool add_account,
[email protected]6c465292014-01-14 15:38:31710 const base::Closure& callback) {
[email protected]dee01572014-04-18 22:33:44711 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]09cff78782014-04-20 22:04:48712 GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL()
713 : cloud_devices::GetCloudPrintSigninURL();
714 content::WebContents* web_contents = browser->OpenURL(
715 content::OpenURLParams(google_util::AppendGoogleLocaleParam(url),
716 content::Referrer(),
717 NEW_FOREGROUND_TAB,
718 content::PAGE_TRANSITION_AUTO_BOOKMARK,
719 false));
720 new SignInObserver(web_contents, cloud_devices::GetCloudPrintURL(), callback);
[email protected]4cd49022012-01-19 20:37:37721}
722
[email protected]b5b79d72012-05-24 19:42:28723void CreatePrintDialogForBytes(content::BrowserContext* browser_context,
724 gfx::NativeWindow modal_parent,
[email protected]a9723e12013-03-05 04:02:45725 const base::RefCountedMemory* data,
[email protected]0085863a2013-12-06 21:19:03726 const base::string16& print_job_title,
727 const base::string16& print_ticket,
[email protected]b5b79d72012-05-24 19:42:28728 const std::string& file_type) {
[email protected]a9723e12013-03-05 04:02:45729 internal_cloud_print_helpers::CreateDialogImpl(browser_context, modal_parent,
730 data, print_job_title,
[email protected]6c465292014-01-14 15:38:31731 print_ticket, file_type);
[email protected]6085c70d2011-03-22 22:51:07732}
733
[email protected]39c61872013-12-13 11:48:02734bool CreatePrintDialogFromCommandLine(Profile* profile,
735 const CommandLine& command_line) {
[email protected]87ab41e72012-01-04 18:45:11736 DCHECK(command_line.HasSwitch(switches::kCloudPrintFile));
[email protected]65c9d89a2011-04-13 21:02:39737 if (!command_line.GetSwitchValuePath(switches::kCloudPrintFile).empty()) {
[email protected]650b2d52013-02-10 03:41:45738 base::FilePath cloud_print_file;
[email protected]65c9d89a2011-04-13 21:02:39739 cloud_print_file =
740 command_line.GetSwitchValuePath(switches::kCloudPrintFile);
741 if (!cloud_print_file.empty()) {
[email protected]0085863a2013-12-06 21:19:03742 base::string16 print_job_title;
743 base::string16 print_job_print_ticket;
[email protected]65c9d89a2011-04-13 21:02:39744 if (command_line.HasSwitch(switches::kCloudPrintJobTitle)) {
[email protected]e8368e92011-08-20 04:05:56745 print_job_title =
746 internal_cloud_print_helpers::GetSwitchValueString16(
747 command_line, switches::kCloudPrintJobTitle);
748 }
749 if (command_line.HasSwitch(switches::kCloudPrintPrintTicket)) {
750 print_job_print_ticket =
751 internal_cloud_print_helpers::GetSwitchValueString16(
752 command_line, switches::kCloudPrintPrintTicket);
[email protected]65c9d89a2011-04-13 21:02:39753 }
754 std::string file_type = "application/pdf";
755 if (command_line.HasSwitch(switches::kCloudPrintFileType)) {
756 file_type = command_line.GetSwitchValueASCII(
757 switches::kCloudPrintFileType);
758 }
[email protected]e8368e92011-08-20 04:05:56759
[email protected]c9060842014-03-13 01:26:19760 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL,
761 cloud_print_file, print_job_title, print_job_print_ticket, file_type);
[email protected]65c9d89a2011-04-13 21:02:39762 return true;
763 }
764 }
765 return false;
766}
767
[email protected]228f0f02013-11-15 05:58:36768} // namespace print_dialog_cloud