Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: android_webview/renderer/print_web_view_helper.h

Issue 54963005: Upstream printing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address code review Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(blink::WebFrame* frame, bool user_initiated) OVERRIDE; 115 virtual void PrintPage(blink::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
joth 2013/11/21 19:38:03 - \n
sgurun-gerrit only 2013/11/23 01:49:11 Done.
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
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.
joth 2013/11/21 19:38:03 rather than the edits here, can this just be calle
sgurun-gerrit only 2013/11/23 01:49:11 Done.
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(blink::WebFrame* frame, const blink::WebNode& node); 201 void Print(blink::WebFrame* frame, const blink::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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698