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 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Mapping from PrintPreviewUI ID to print preview request ID. | 100 // Mapping from PrintPreviewUI ID to print preview request ID. |
101 typedef std::map<int, int> PrintPreviewRequestIdMap; | 101 typedef std::map<int, int> PrintPreviewRequestIdMap; |
102 | 102 |
103 PrintPreviewRequestIdMap map_; | 103 PrintPreviewRequestIdMap map_; |
104 base::Lock lock_; | 104 base::Lock lock_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(PrintPreviewRequestIdMapWithLock); | 106 DISALLOW_COPY_AND_ASSIGN(PrintPreviewRequestIdMapWithLock); |
107 }; | 107 }; |
108 | 108 |
109 // Written to on the UI thread, read from any thread. | 109 // Written to on the UI thread, read from any thread. |
110 base::LazyInstance<PrintPreviewRequestIdMapWithLock> | 110 base::LazyInstance<PrintPreviewRequestIdMapWithLock>::DestructorAtExit |
111 g_print_preview_request_id_map = LAZY_INSTANCE_INITIALIZER; | 111 g_print_preview_request_id_map = LAZY_INSTANCE_INITIALIZER; |
112 | 112 |
113 // PrintPreviewUI IDMap used to avoid exposing raw pointer addresses to WebUI. | 113 // PrintPreviewUI IDMap used to avoid exposing raw pointer addresses to WebUI. |
114 // Only accessed on the UI thread. | 114 // Only accessed on the UI thread. |
115 base::LazyInstance<IDMap<PrintPreviewUI*>> g_print_preview_ui_id_map = | 115 base::LazyInstance<IDMap<PrintPreviewUI*>>::DestructorAtExit |
116 LAZY_INSTANCE_INITIALIZER; | 116 g_print_preview_ui_id_map = LAZY_INSTANCE_INITIALIZER; |
117 | 117 |
118 // PrintPreviewUI serves data for chrome://print requests. | 118 // PrintPreviewUI serves data for chrome://print requests. |
119 // | 119 // |
120 // The format for requesting PDF data is as follows: | 120 // The format for requesting PDF data is as follows: |
121 // chrome://print/<PrintPreviewUIID>/<PageIndex>/print.pdf | 121 // chrome://print/<PrintPreviewUIID>/<PageIndex>/print.pdf |
122 // | 122 // |
123 // Parameters (< > required): | 123 // Parameters (< > required): |
124 // <PrintPreviewUIID> = PrintPreview UI ID | 124 // <PrintPreviewUIID> = PrintPreview UI ID |
125 // <PageIndex> = Page index is zero-based or | 125 // <PageIndex> = Page index is zero-based or |
126 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent | 126 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 } | 695 } |
696 | 696 |
697 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 697 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
698 handler_->FileSelected(path, 0, NULL); | 698 handler_->FileSelected(path, 0, NULL); |
699 } | 699 } |
700 | 700 |
701 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 701 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
702 const base::Closure& closure) { | 702 const base::Closure& closure) { |
703 handler_->SetPdfSavedClosureForTesting(closure); | 703 handler_->SetPdfSavedClosureForTesting(closure); |
704 } | 704 } |
OLD | NEW |