| 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/ui/webui/print_preview/print_preview_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/printing/background_printing_manager.h" | 16 #include "chrome/browser/printing/background_printing_manager.h" |
| 17 #include "chrome/browser/printing/print_preview_data_service.h" | 17 #include "chrome/browser/printing/print_preview_data_service.h" |
| 18 #include "chrome/browser/printing/print_preview_tab_controller.h" | 18 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 21 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 21 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 22 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 23 #include "chrome/browser/ui/webui/web_dialog_ui.h" | |
| 24 #include "chrome/browser/ui/webui/print_preview/print_preview_data_source.h" | 22 #include "chrome/browser/ui/webui/print_preview/print_preview_data_source.h" |
| 25 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" | 23 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
| 26 #include "chrome/common/print_messages.h" | 24 #include "chrome/common/print_messages.h" |
| 27 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 28 #include "printing/page_size_margins.h" | 26 #include "printing/page_size_margins.h" |
| 29 #include "printing/print_job_constants.h" | 27 #include "printing/print_job_constants.h" |
| 30 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
| 29 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 30 #include "ui/web_dialogs/web_dialog_ui.h" |
| 31 | 31 |
| 32 using content::WebContents; | 32 using content::WebContents; |
| 33 using printing::PageSizeMargins; | 33 using printing::PageSizeMargins; |
| 34 using ui::ConstrainedWebDialogDelegate; |
| 35 using ui::ConstrainedWebDialogUI; |
| 34 | 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 // Thread-safe wrapper around a std::map to keep track of mappings from | 39 // Thread-safe wrapper around a std::map to keep track of mappings from |
| 38 // PrintPreviewUI addresses to most recent print preview request ids. | 40 // PrintPreviewUI addresses to most recent print preview request ids. |
| 39 class PrintPreviewRequestIdMapWithLock { | 41 class PrintPreviewRequestIdMapWithLock { |
| 40 public: | 42 public: |
| 41 PrintPreviewRequestIdMapWithLock() {} | 43 PrintPreviewRequestIdMapWithLock() {} |
| 42 ~PrintPreviewRequestIdMapWithLock() {} | 44 ~PrintPreviewRequestIdMapWithLock() {} |
| 43 | 45 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 delegate->OnDialogCloseFromWebUI(); | 320 delegate->OnDialogCloseFromWebUI(); |
| 319 } | 321 } |
| 320 | 322 |
| 321 void PrintPreviewUI::OnReloadPrintersList() { | 323 void PrintPreviewUI::OnReloadPrintersList() { |
| 322 web_ui()->CallJavascriptFunction("reloadPrintersList"); | 324 web_ui()->CallJavascriptFunction("reloadPrintersList"); |
| 323 } | 325 } |
| 324 | 326 |
| 325 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { | 327 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { |
| 326 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 328 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); |
| 327 } | 329 } |
| OLD | NEW |