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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 13 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
13 | 14 |
14 // PrintPreviewDataSource serves data for chrome://print requests. | 15 // PrintPreviewDataSource serves data for chrome://print requests. |
15 // | 16 // |
16 // The format for requesting data is as follows: | 17 // The format for requesting PDF data is as follows: |
17 // chrome://print/<PrintPreviewUIAddrStr>/<PageIndex>/print.pdf | 18 // chrome://print/<PrintPreviewUIAddrStr>/<PageIndex>/print.pdf |
18 // | 19 // |
19 // Parameters (< > required): | 20 // Parameters (< > required): |
20 // <PrintPreviewUIAddrStr> = Print preview UI identifier. | 21 // <PrintPreviewUIAddrStr> = Print preview UI identifier. |
21 // <PageIndex> = Page index is zero-based or | 22 // <PageIndex> = Page index is zero-based or |
22 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent | 23 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent |
23 // a print ready PDF. | 24 // a print ready PDF. |
24 // | 25 // |
25 // Example: | 26 // Example: |
26 // chrome://print/0xab0123ef/10/print.pdf | 27 // chrome://print/0xab0123ef/10/print.pdf |
27 | 28 // |
28 class PrintPreviewDataSource : public ChromeURLDataManager::DataSource { | 29 // Requests to chrome://print with paths not ending in /print.pdf are used |
| 30 // to return the markup or other resources for the print preview page itself. |
| 31 class PrintPreviewDataSource : public ChromeWebUIDataSource { |
29 public: | 32 public: |
30 PrintPreviewDataSource(); | 33 PrintPreviewDataSource(); |
31 | 34 |
32 // ChromeURLDataManager::DataSource implementation. | 35 // ChromeURLDataManager::DataSource implementation. |
33 virtual void StartDataRequest(const std::string& path, | 36 virtual void StartDataRequest(const std::string& path, |
34 bool is_incognito, | 37 bool is_incognito, |
35 int request_id) OVERRIDE; | 38 int request_id) OVERRIDE; |
36 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | |
37 | |
38 private: | 39 private: |
39 virtual ~PrintPreviewDataSource(); | 40 virtual ~PrintPreviewDataSource(); |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataSource); | 42 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataSource); |
42 }; | 43 }; |
43 | 44 |
44 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ | 45 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_DATA_SOURCE_H_ |
OLD | NEW |