| 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 24 matching lines...) Expand all Loading... |
| 35 #include "content/public/browser/navigation_entry.h" | 35 #include "content/public/browser/navigation_entry.h" |
| 36 #include "content/public/browser/notification_registrar.h" | 36 #include "content/public/browser/notification_registrar.h" |
| 37 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
| 38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "webkit/glue/webpreferences.h" | 41 #include "webkit/glue/webpreferences.h" |
| 42 | 42 |
| 43 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
| 44 | 44 |
| 45 #if defined(USE_AURA) |
| 46 #include "chrome/browser/ui/browser_window.h" |
| 47 #include "chrome/browser/ui/views/html_dialog_view.h" |
| 48 #include "ui/views/widget/widget.h" |
| 49 #endif |
| 50 |
| 45 // This module implements the UI support in Chrome for cloud printing. | 51 // This module implements the UI support in Chrome for cloud printing. |
| 46 // This means hosting a dialog containing HTML/JavaScript and using | 52 // This means hosting a dialog containing HTML/JavaScript and using |
| 47 // the published cloud print user interface integration APIs to get | 53 // the published cloud print user interface integration APIs to get |
| 48 // page setup settings from the dialog contents and provide the | 54 // page setup settings from the dialog contents and provide the |
| 49 // generated print data to the dialog contents for uploading to the | 55 // generated print data to the dialog contents for uploading to the |
| 50 // cloud print service. | 56 // cloud print service. |
| 51 | 57 |
| 52 // Currently, the flow between these classes is as follows: | 58 // Currently, the flow between these classes is as follows: |
| 53 | 59 |
| 54 // PrintDialogCloud::CreatePrintDialogForFile is called from | 60 // PrintDialogCloud::CreatePrintDialogForFile is called from |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 639 |
| 634 int width = pref_service->GetInteger(prefs::kCloudPrintDialogWidth); | 640 int width = pref_service->GetInteger(prefs::kCloudPrintDialogWidth); |
| 635 int height = pref_service->GetInteger(prefs::kCloudPrintDialogHeight); | 641 int height = pref_service->GetInteger(prefs::kCloudPrintDialogHeight); |
| 636 | 642 |
| 637 HtmlDialogUIDelegate* dialog_delegate = | 643 HtmlDialogUIDelegate* dialog_delegate = |
| 638 new internal_cloud_print_helpers::CloudPrintHtmlDialogDelegate( | 644 new internal_cloud_print_helpers::CloudPrintHtmlDialogDelegate( |
| 639 path_to_file, width, height, std::string(), job_title, print_ticket, | 645 path_to_file, width, height, std::string(), job_title, print_ticket, |
| 640 file_type, modal, delete_on_close); | 646 file_type, modal, delete_on_close); |
| 641 if (modal) { | 647 if (modal) { |
| 642 DCHECK(browser); | 648 DCHECK(browser); |
| 649 #if defined(USE_AURA) |
| 650 HtmlDialogView* html_view = |
| 651 new HtmlDialogView(profile, dialog_delegate); |
| 652 views::Widget::CreateWindowWithParent(html_view, |
| 653 browser->window()->GetNativeHandle()); |
| 654 html_view->InitDialog(); |
| 655 html_view->GetWidget()->Show(); |
| 656 #else |
| 643 browser->BrowserShowHtmlDialog(dialog_delegate, NULL, STYLE_GENERIC); | 657 browser->BrowserShowHtmlDialog(dialog_delegate, NULL, STYLE_GENERIC); |
| 658 #endif |
| 644 } else { | 659 } else { |
| 645 browser::ShowHtmlDialog(NULL, profile, dialog_delegate, STYLE_GENERIC); | 660 browser::ShowHtmlDialog(NULL, profile, dialog_delegate, STYLE_GENERIC); |
| 646 } | 661 } |
| 647 } | 662 } |
| 648 | 663 |
| 649 // Provides a runnable function to delete a file. | 664 // Provides a runnable function to delete a file. |
| 650 void Delete(const FilePath& file_path) { | 665 void Delete(const FilePath& file_path) { |
| 651 file_util::Delete(file_path, false); | 666 file_util::Delete(file_path, false); |
| 652 } | 667 } |
| 653 | 668 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 file_type, | 741 file_type, |
| 727 false, | 742 false, |
| 728 delete_on_close); | 743 delete_on_close); |
| 729 return true; | 744 return true; |
| 730 } | 745 } |
| 731 } | 746 } |
| 732 return false; | 747 return false; |
| 733 } | 748 } |
| 734 | 749 |
| 735 } // end namespace | 750 } // end namespace |
| OLD | NEW |