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

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

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | chrome/renderer/print_web_view_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_DELEGATE_H_ 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "webkit/glue/webview_delegate.h" 11 #include "webkit/glue/webview_delegate.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Size; 14 class Size;
15 } 15 }
16 16
17 namespace IPC { 17 namespace IPC {
18 class Message; 18 class Message;
19 } 19 }
20 20
21 class RenderView; 21 class RenderView;
22 class WebView; 22 class WebView;
23 struct ViewMsg_Print_Params;
23 struct ViewMsg_PrintPage_Params; 24 struct ViewMsg_PrintPage_Params;
24 struct ViewMsg_PrintPages_Params; 25 struct ViewMsg_PrintPages_Params;
25 26
26 27
27 // PrintWebViewHelper handles most of the printing grunt work for RenderView. 28 // PrintWebViewHelper handles most of the printing grunt work for RenderView.
28 // We plan on making print asynchronous and that will require copying the DOM 29 // We plan on making print asynchronous and that will require copying the DOM
29 // of the document and creating a new WebView with the contents. 30 // of the document and creating a new WebView with the contents.
30 class PrintWebViewHelper : public WebViewDelegate { 31 class PrintWebViewHelper : public WebViewDelegate {
31 public: 32 public:
32 explicit PrintWebViewHelper(RenderView * render_view) 33 explicit PrintWebViewHelper(RenderView * render_view)
33 : render_view_(render_view) {} 34 : render_view_(render_view) {}
34 35
35 virtual ~PrintWebViewHelper() {} 36 virtual ~PrintWebViewHelper() {}
36 37
37 void SyncPrint(WebFrame* frame); 38 void SyncPrint(WebFrame* frame);
38 39
40 // Is there a background print in progress?
41 bool IsPrinting() {
42 return print_web_view_.get() != NULL;
43 }
44
45 // Notification when printing is done - signal teardown
46 void DidFinishPrinting(bool success);
47
39 protected: 48 protected:
49 bool CopyAndPrint(const ViewMsg_PrintPages_Params& params,
50 WebFrame* web_frame);
40 51
41 // Prints the page listed in |params|. 52 // Prints the page listed in |params|.
42 void PrintPage(const ViewMsg_PrintPage_Params& params, 53 void PrintPage(const ViewMsg_PrintPage_Params& params,
43 const gfx::Size& canvas_size, 54 const gfx::Size& canvas_size,
44 WebFrame* frame); 55 WebFrame* frame);
45 56
46 // Prints all the pages listed in |params|. 57 // Prints all the pages listed in |params|.
58 // It will implicitly revert the document to display CSS media type.
47 void PrintPages(const ViewMsg_PrintPages_Params& params, WebFrame* frame); 59 void PrintPages(const ViewMsg_PrintPages_Params& params, WebFrame* frame);
48 60
49 // IPC::Message::Sender 61 // IPC::Message::Sender
50 bool Send(IPC::Message* msg); 62 bool Send(IPC::Message* msg);
51 63
52 int32 routing_id(); 64 int32 routing_id();
53 65
54 // WebViewDeletegate 66 // WebViewDeletegate
55 virtual void DidStartLoading(WebView* webview) {}
56 virtual void DidStopLoading(WebView* webview); 67 virtual void DidStopLoading(WebView* webview);
57 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); 68 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget);
58 virtual void DidInvalidateRect(WebWidget* webwidget, 69 virtual void DidInvalidateRect(WebWidget* webwidget,
59 const WebKit::WebRect& rect) {} 70 const WebKit::WebRect& rect) {}
60 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, 71 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
61 const WebKit::WebRect& clip_rect) {} 72 const WebKit::WebRect& clip_rect) {}
62 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition) {} 73 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition) {}
63 virtual void ShowAsPopupWithItems(WebWidget* webwidget, 74 virtual void ShowAsPopupWithItems(WebWidget* webwidget,
64 const WebKit::WebRect& bounds, 75 const WebKit::WebRect& bounds,
65 int item_height, 76 int item_height,
(...skipping 12 matching lines...) Expand all
78 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move) {} 89 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move) {}
79 virtual void RunModal(WebWidget* webwidget) {} 90 virtual void RunModal(WebWidget* webwidget) {}
80 virtual void AddRef() {} 91 virtual void AddRef() {}
81 virtual void Release() {} 92 virtual void Release() {}
82 virtual bool IsHidden(WebWidget* webwidget); 93 virtual bool IsHidden(WebWidget* webwidget);
83 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget); 94 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget);
84 95
85 private: 96 private:
86 RenderView* render_view_; 97 RenderView* render_view_;
87 scoped_ptr<WebView> print_web_view_; 98 scoped_ptr<WebView> print_web_view_;
99 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_;
88 100
89 private: 101 private:
90 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); 102 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper);
91 }; 103 };
92 104
93 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ 105 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | chrome/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698