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

Side by Side Diff: chrome/browser/printing/print_view_manager.h

Issue 6374009: Get rid of a few more interfaces from RenderViewHostDelegate that aren't need... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/browser/file_select_helper.h ('k') | chrome/browser/printing/print_view_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_PRINTING_PRINT_VIEW_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 11 #include "chrome/browser/tab_contents/web_navigation_observer.h"
12 #include "chrome/common/notification_observer.h" 12 #include "chrome/common/notification_observer.h"
13 #include "chrome/common/notification_registrar.h" 13 #include "chrome/common/notification_registrar.h"
14 #include "printing/printed_pages_source.h" 14 #include "printing/printed_pages_source.h"
15 15
16 class RenderViewHost; 16 class RenderViewHost;
17 class TabContents; 17 class TabContents;
18 struct ViewHostMsg_DidPrintPage_Params; 18 struct ViewHostMsg_DidPrintPage_Params;
19 19
20 namespace printing { 20 namespace printing {
21 21
22 class JobEventDetails; 22 class JobEventDetails;
23 class PrintJob; 23 class PrintJob;
24 class PrintJobWorkerOwner; 24 class PrintJobWorkerOwner;
25 25
26 // Manages the print commands in relation to a TabContents. TabContents 26 // Manages the print commands in relation to a TabContents. TabContents
27 // delegates a few printing related commands to this instance. 27 // delegates a few printing related commands to this instance.
28 class PrintViewManager : public NotificationObserver, 28 class PrintViewManager : public NotificationObserver,
29 public PrintedPagesSource, 29 public PrintedPagesSource,
30 public RenderViewHostDelegate::Printing { 30 public WebNavigationObserver {
31 public: 31 public:
32 explicit PrintViewManager(TabContents& owner); 32 explicit PrintViewManager(TabContents& owner);
33 virtual ~PrintViewManager(); 33 virtual ~PrintViewManager();
34 34
35 // Cancels the print job. 35 // Cancels the print job.
36 void Stop(); 36 void Stop();
37 37
38 // Terminates or cancels the print job if one was pending, depending on the 38 // Terminates or cancels the print job if one was pending, depending on the
39 // current state. Returns false if the renderer was not valuable. 39 // current state. Returns false if the renderer was not valuable.
40 bool OnRenderViewGone(RenderViewHost* render_view_host); 40 bool OnRenderViewGone(RenderViewHost* render_view_host);
41 41
42 // PrintedPagesSource implementation. 42 // PrintedPagesSource implementation.
43 virtual string16 RenderSourceName(); 43 virtual string16 RenderSourceName();
44 virtual GURL RenderSourceUrl(); 44 virtual GURL RenderSourceUrl();
45 45
46 // RenderViewHostDelegate::Printing implementation.
47 virtual void DidGetPrintedPagesCount(int cookie, int number_pages);
48 virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
49
50 // NotificationObserver implementation. 46 // NotificationObserver implementation.
51 virtual void Observe(NotificationType type, 47 virtual void Observe(NotificationType type,
52 const NotificationSource& source, 48 const NotificationSource& source,
53 const NotificationDetails& details); 49 const NotificationDetails& details);
54 50
51 // WebNavigationObserver implementation.
52 virtual bool OnMessageReceived(const IPC::Message& message);
53
55 private: 54 private:
55 void OnDidGetPrintedPagesCount(int cookie, int number_pages);
56 void OnDidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
57
56 // Processes a NOTIFY_PRINT_JOB_EVENT notification. 58 // Processes a NOTIFY_PRINT_JOB_EVENT notification.
57 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); 59 void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
58 60
59 // Requests the RenderView to render all the missing pages for the print job. 61 // Requests the RenderView to render all the missing pages for the print job.
60 // Noop if no print job is pending. Returns true if at least one page has been 62 // Noop if no print job is pending. Returns true if at least one page has been
61 // requested to the renderer. 63 // requested to the renderer.
62 bool RenderAllMissingPagesNow(); 64 bool RenderAllMissingPagesNow();
63 65
64 // Quits the current message loop if these conditions hold true: a document is 66 // Quits the current message loop if these conditions hold true: a document is
65 // loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This 67 // loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // printing-related behavior. Still, access to the renderer is needed so a 125 // printing-related behavior. Still, access to the renderer is needed so a
124 // back reference is kept the the "parent object". 126 // back reference is kept the the "parent object".
125 TabContents& owner_; 127 TabContents& owner_;
126 128
127 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); 129 DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
128 }; 130 };
129 131
130 } // namespace printing 132 } // namespace printing
131 133
132 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ 134 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/file_select_helper.h ('k') | chrome/browser/printing/print_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698