| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 6 #define AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
| 16 #include "content/public/renderer/render_view_observer_tracker.h" | 16 #include "content/public/renderer/render_view_observer_tracker.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, | 109 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, |
| 110 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). | 110 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // RenderViewObserver implementation. | 113 // RenderViewObserver implementation. |
| 114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 115 virtual void PrintPage(WebKit::WebFrame* frame, bool user_initiated) OVERRIDE; | 115 virtual void PrintPage(WebKit::WebFrame* frame, bool user_initiated) OVERRIDE; |
| 116 virtual void DidStartLoading() OVERRIDE; | 116 virtual void DidStartLoading() OVERRIDE; |
| 117 virtual void DidStopLoading() OVERRIDE; | 117 virtual void DidStopLoading() OVERRIDE; |
| 118 | 118 |
| 119 |
| 119 // Message handlers --------------------------------------------------------- | 120 // Message handlers --------------------------------------------------------- |
| 120 | 121 |
| 121 // Print the document. | 122 // Print the document. |
| 122 void OnPrintPages(); | 123 void OnPrintPages(); |
| 123 | 124 |
| 124 // Print the document with the print preview frame/node. | 125 // Print the document with the print preview frame/node. |
| 125 void OnPrintForSystemDialog(); | 126 void OnPrintForSystemDialog(); |
| 126 | 127 |
| 127 // Get |page_size| and |content_area| information from | 128 // Get |page_size| and |content_area| information from |
| 128 // |page_layout_in_points|. | 129 // |page_layout_in_points|. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 // Print / preview the node under the context menu. | 183 // Print / preview the node under the context menu. |
| 183 void OnPrintNodeUnderContextMenu(); | 184 void OnPrintNodeUnderContextMenu(); |
| 184 | 185 |
| 185 // Print the pages for print preview. Do not display the native print dialog | 186 // Print the pages for print preview. Do not display the native print dialog |
| 186 // for user settings. |job_settings| has new print job settings values. | 187 // for user settings. |job_settings| has new print job settings values. |
| 187 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); | 188 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); |
| 188 | 189 |
| 189 void OnPrintingDone(bool success); | 190 void OnPrintingDone(bool success); |
| 190 | 191 |
| 192 public: |
| 193 // TODO(sgurun) android_webview disables scripted prints by default. |
| 191 // Enable/Disable window.print calls. If |blocked| is true window.print | 194 // Enable/Disable window.print calls. If |blocked| is true window.print |
| 192 // calls will silently fail. Call with |blocked| set to false to reenable. | 195 // calls will silently fail. Call with |blocked| set to false to reenable. |
| 193 void SetScriptedPrintBlocked(bool blocked); | 196 void SetScriptedPrintBlocked(bool blocked); |
| 197 private: |
| 194 | 198 |
| 195 // Main printing code ------------------------------------------------------- | 199 // Main printing code ------------------------------------------------------- |
| 196 | 200 |
| 197 void Print(WebKit::WebFrame* frame, const WebKit::WebNode& node); | 201 void Print(WebKit::WebFrame* frame, const WebKit::WebNode& node); |
| 198 | 202 |
| 199 // Notification when printing is done - signal tear-down/free resources. | 203 // Notification when printing is done - signal tear-down/free resources. |
| 200 void DidFinishPrinting(PrintingResult result); | 204 void DidFinishPrinting(PrintingResult result); |
| 201 | 205 |
| 202 // Print Settings ----------------------------------------------------------- | 206 // Print Settings ----------------------------------------------------------- |
| 203 | 207 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 bool print_node_in_progress_; | 483 bool print_node_in_progress_; |
| 480 PrintPreviewContext print_preview_context_; | 484 PrintPreviewContext print_preview_context_; |
| 481 bool is_loading_; | 485 bool is_loading_; |
| 482 bool is_scripted_preview_delayed_; | 486 bool is_scripted_preview_delayed_; |
| 483 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 487 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 484 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 488 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 485 }; | 489 }; |
| 486 | 490 |
| 487 } // namespace printing | 491 } // namespace printing |
| 488 | 492 |
| 489 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 493 #endif // AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |