| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
| 7 | 7 |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // PrintDialogCloud::CreatePrintDialogForFile is called from | 47 // PrintDialogCloud::CreatePrintDialogForFile is called from |
| 48 // resource_message_filter_gtk.cc once the renderer has informed the | 48 // resource_message_filter_gtk.cc once the renderer has informed the |
| 49 // renderer host that print data generation into the renderer host provided | 49 // renderer host that print data generation into the renderer host provided |
| 50 // temp file has been completed. That call is on the FILE thread. | 50 // temp file has been completed. That call is on the FILE thread. |
| 51 // That, in turn, hops over to the UI thread to create an instance of | 51 // That, in turn, hops over to the UI thread to create an instance of |
| 52 // PrintDialogCloud. | 52 // PrintDialogCloud. |
| 53 | 53 |
| 54 // The constructor for PrintDialogCloud creates a | 54 // The constructor for PrintDialogCloud creates a |
| 55 // CloudPrintHtmlDialogDelegate and asks the current active browser to | 55 // CloudPrintHtmlDialogDelegate and asks the current active browser to |
| 56 // show an HTML dialog using that class as the delegate. That class | 56 // show an HTML dialog using that class as the delegate. That class |
| 57 // hands in the kChromeUICloudPrintResourcesURL as the URL to visit. That is | 57 // hands in the kCloudPrintResourcesURL as the URL to visit. That is |
| 58 // recognized by the GetWebUIFactoryFunction as a signal to create an | 58 // recognized by the GetWebUIFactoryFunction as a signal to create an |
| 59 // ExternalHtmlDialogUI. | 59 // ExternalHtmlDialogUI. |
| 60 | 60 |
| 61 // CloudPrintHtmlDialogDelegate also temporarily owns a | 61 // CloudPrintHtmlDialogDelegate also temporarily owns a |
| 62 // CloudPrintFlowHandler, a class which is responsible for the actual | 62 // CloudPrintFlowHandler, a class which is responsible for the actual |
| 63 // interactions with the dialog contents, including handing in the | 63 // interactions with the dialog contents, including handing in the |
| 64 // print data and getting any page setup parameters that the dialog | 64 // print data and getting any page setup parameters that the dialog |
| 65 // contents provides. As part of bringing up the dialog, | 65 // contents provides. As part of bringing up the dialog, |
| 66 // HtmlDialogUI::RenderViewCreated is called (an override of | 66 // HtmlDialogUI::RenderViewCreated is called (an override of |
| 67 // WebUI::RenderViewCreated). That routine, in turn, calls the | 67 // WebUI::RenderViewCreated). That routine, in turn, calls the |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 : flow_handler_(flow_handler), | 417 : flow_handler_(flow_handler), |
| 418 modal_(modal), | 418 modal_(modal), |
| 419 owns_flow_handler_(true) { | 419 owns_flow_handler_(true) { |
| 420 Init(width, height, json_arguments); | 420 Init(width, height, json_arguments); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void CloudPrintHtmlDialogDelegate::Init(int width, int height, | 423 void CloudPrintHtmlDialogDelegate::Init(int width, int height, |
| 424 const std::string& json_arguments) { | 424 const std::string& json_arguments) { |
| 425 // This information is needed to show the dialog HTML content. | 425 // This information is needed to show the dialog HTML content. |
| 426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 427 params_.url = GURL(chrome::kChromeUICloudPrintResourcesURL); | 427 params_.url = GURL(chrome::kCloudPrintResourcesURL); |
| 428 params_.height = height; | 428 params_.height = height; |
| 429 params_.width = width; | 429 params_.width = width; |
| 430 params_.json_input = json_arguments; | 430 params_.json_input = json_arguments; |
| 431 | 431 |
| 432 flow_handler_->SetDialogDelegate(this); | 432 flow_handler_->SetDialogDelegate(this); |
| 433 // If we're not modal we can show the dialog with no browser. | 433 // If we're not modal we can show the dialog with no browser. |
| 434 // We need this to keep Chrome alive while our dialog is up. | 434 // We need this to keep Chrome alive while our dialog is up. |
| 435 if (!modal_) | 435 if (!modal_) |
| 436 BrowserList::StartKeepAlive(); | 436 BrowserList::StartKeepAlive(); |
| 437 } | 437 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 print_job_title, | 617 print_job_title, |
| 618 file_type, | 618 file_type, |
| 619 false); | 619 false); |
| 620 return true; | 620 return true; |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 return false; | 623 return false; |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // end namespace | 626 } // end namespace |
| OLD | NEW |