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_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 public RenderViewObserverTracker<PrintWebViewHelper>, | 72 public RenderViewObserverTracker<PrintWebViewHelper>, |
73 public WebKit::WebViewClient, | 73 public WebKit::WebViewClient, |
74 public WebKit::WebFrameClient { | 74 public WebKit::WebFrameClient { |
75 public: | 75 public: |
76 explicit PrintWebViewHelper(RenderView* render_view); | 76 explicit PrintWebViewHelper(RenderView* render_view); |
77 virtual ~PrintWebViewHelper(); | 77 virtual ~PrintWebViewHelper(); |
78 | 78 |
79 protected: | 79 protected: |
80 // WebKit::WebViewClient override: | 80 // WebKit::WebViewClient override: |
81 virtual void didStopLoading(); | 81 virtual void didStopLoading(); |
82 | |
83 private: | 82 private: |
84 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 83 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, |
85 BlockScriptInitiatedPrinting); | 84 BlockScriptInitiatedPrinting); |
86 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 85 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); |
87 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); | 86 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); |
88 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewCancel); | 87 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewCancel); |
89 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); | 88 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); |
90 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 89 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
91 OnPrintForPrintPreview); | 90 OnPrintForPrintPreview); |
92 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 91 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 141 |
143 // Initialize print page settings with default settings. | 142 // Initialize print page settings with default settings. |
144 bool InitPrintSettings(WebKit::WebFrame* frame, | 143 bool InitPrintSettings(WebKit::WebFrame* frame, |
145 WebKit::WebNode* node); | 144 WebKit::WebNode* node); |
146 | 145 |
147 // Update the current print settings with new |job_settings|. |job_settings| | 146 // Update the current print settings with new |job_settings|. |job_settings| |
148 // dictionary contains print job details such as printer name, number of | 147 // dictionary contains print job details such as printer name, number of |
149 // copies, page range, etc. | 148 // copies, page range, etc. |
150 bool UpdatePrintSettings(const base::DictionaryValue& job_settings); | 149 bool UpdatePrintSettings(const base::DictionaryValue& job_settings); |
151 | 150 |
| 151 // Update the current print settings for a cloud print printer with new |
| 152 // |job_settings|. |job_settings| dictionary contains print job details |
| 153 // such as printer name, number of copies, page range, etc. |
| 154 bool UpdatePrintSettingsCloud(const base::DictionaryValue& job_settings); |
| 155 |
| 156 // Update the current print settings for a local printer with new |
| 157 // |job_settings|. |job_settings| dictionary contains print job details |
| 158 // such as printer name, number of copies, page range, etc. |
| 159 bool UpdatePrintSettingsLocal(const base::DictionaryValue& job_settings); |
| 160 |
152 // Get final print settings from the user. | 161 // Get final print settings from the user. |
153 // Return false if the user cancels or on error. | 162 // Return false if the user cancels or on error. |
154 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, | 163 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
155 int expected_pages_count, | 164 int expected_pages_count, |
156 bool use_browser_overlays); | 165 bool use_browser_overlays); |
157 | 166 |
158 // Page Printing / Rendering ------------------------------------------------ | 167 // Page Printing / Rendering ------------------------------------------------ |
159 | 168 |
160 // Prints all the pages listed in |params|. | 169 // Prints all the pages listed in |params|. |
161 // It will implicitly revert the document to display CSS media type. | 170 // It will implicitly revert the document to display CSS media type. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // the failure came from the browser in the first place. | 292 // the failure came from the browser in the first place. |
284 bool notify_browser_of_print_failure_; | 293 bool notify_browser_of_print_failure_; |
285 | 294 |
286 int preview_page_count_; | 295 int preview_page_count_; |
287 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; | 296 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; |
288 | 297 |
289 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 298 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
290 }; | 299 }; |
291 | 300 |
292 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 301 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |