| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 params_.url = GURL(chrome::kChromeUICloudPrintResourcesURL); | 556 params_.url = GURL(chrome::kChromeUICloudPrintResourcesURL); |
| 557 GetDialogWidthAndHeightFromPrefs(browser_context, | 557 GetDialogWidthAndHeightFromPrefs(browser_context, |
| 558 ¶ms_.width, | 558 ¶ms_.width, |
| 559 ¶ms_.height); | 559 ¶ms_.height); |
| 560 params_.json_input = json_arguments; | 560 params_.json_input = json_arguments; |
| 561 | 561 |
| 562 flow_handler_->SetDialogDelegate(this); | 562 flow_handler_->SetDialogDelegate(this); |
| 563 // If we're not modal we can show the dialog with no browser. | 563 // If we're not modal we can show the dialog with no browser. |
| 564 // We need this to keep Chrome alive while our dialog is up. | 564 // We need this to keep Chrome alive while our dialog is up. |
| 565 if (!modal_parent_ && keep_alive_when_non_modal_) | 565 if (!modal_parent_ && keep_alive_when_non_modal_) |
| 566 browser::StartKeepAlive(); | 566 chrome::StartKeepAlive(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 CloudPrintWebDialogDelegate::~CloudPrintWebDialogDelegate() { | 569 CloudPrintWebDialogDelegate::~CloudPrintWebDialogDelegate() { |
| 570 // If the flow_handler_ is about to outlive us because we don't own | 570 // If the flow_handler_ is about to outlive us because we don't own |
| 571 // it anymore, we need to have it remove its reference to us. | 571 // it anymore, we need to have it remove its reference to us. |
| 572 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 572 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 573 flow_handler_->SetDialogDelegate(NULL); | 573 flow_handler_->SetDialogDelegate(NULL); |
| 574 if (owns_flow_handler_) { | 574 if (owns_flow_handler_) { |
| 575 delete flow_handler_; | 575 delete flow_handler_; |
| 576 } | 576 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 613 |
| 614 if (delete_on_close_) { | 614 if (delete_on_close_) { |
| 615 BrowserThread::PostTask( | 615 BrowserThread::PostTask( |
| 616 BrowserThread::FILE, FROM_HERE, | 616 BrowserThread::FILE, FROM_HERE, |
| 617 base::Bind(&internal_cloud_print_helpers::Delete, path_to_file_)); | 617 base::Bind(&internal_cloud_print_helpers::Delete, path_to_file_)); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // If we're modal we can show the dialog with no browser. | 620 // If we're modal we can show the dialog with no browser. |
| 621 // End the keep-alive so that Chrome can exit. | 621 // End the keep-alive so that Chrome can exit. |
| 622 if (!modal_parent_ && keep_alive_when_non_modal_) | 622 if (!modal_parent_ && keep_alive_when_non_modal_) |
| 623 browser::EndKeepAlive(); | 623 chrome::EndKeepAlive(); |
| 624 delete this; | 624 delete this; |
| 625 } | 625 } |
| 626 | 626 |
| 627 void CloudPrintWebDialogDelegate::OnCloseContents(WebContents* source, | 627 void CloudPrintWebDialogDelegate::OnCloseContents(WebContents* source, |
| 628 bool* out_close_dialog) { | 628 bool* out_close_dialog) { |
| 629 if (out_close_dialog) | 629 if (out_close_dialog) |
| 630 *out_close_dialog = true; | 630 *out_close_dialog = true; |
| 631 } | 631 } |
| 632 | 632 |
| 633 bool CloudPrintWebDialogDelegate::ShouldShowDialogTitle() const { | 633 bool CloudPrintWebDialogDelegate::ShouldShowDialogTitle() const { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 print_job_print_ticket, | 834 print_job_print_ticket, |
| 835 file_type, | 835 file_type, |
| 836 delete_on_close); | 836 delete_on_close); |
| 837 return true; | 837 return true; |
| 838 } | 838 } |
| 839 } | 839 } |
| 840 return false; | 840 return false; |
| 841 } | 841 } |
| 842 | 842 |
| 843 } // end namespace | 843 } // end namespace |
| OLD | NEW |